Annotation of hatari/src/debug/profile_priv.h, revision 1.1

1.1     ! root        1: /*
        !             2:  * Hatari - profile_priv.h
        !             3:  * 
        !             4:  * This file is distributed under the GNU General Public License, version 2
        !             5:  * or at your option any later version. Read the file gpl.txt for details.
        !             6:  */
        !             7: 
        !             8: #ifndef HATARI_PROFILE_PRIV_H
        !             9: #define HATARI_PROFILE_PRIV_H
        !            10: 
        !            11: /* caller types */
        !            12: #define CALL_UNDEFINED 0       /* = call type information not supported */
        !            13: typedef enum {
        !            14:        CALL_UNKNOWN    = 1,
        !            15:        CALL_NEXT       = 2,
        !            16:        CALL_BRANCH     = 4,
        !            17:        CALL_SUBROUTINE = 8,
        !            18:        CALL_SUBRETURN  = 16,
        !            19:        CALL_EXCEPTION  = 32,
        !            20:        CALL_EXCRETURN  = 64,
        !            21:        CALL_INTERRUPT  = 128
        !            22: } calltype_t;
        !            23: 
        !            24: typedef struct {
        !            25:        Uint64 calls, count, cycles, misses;
        !            26: } counters_t;
        !            27: 
        !            28: typedef struct {
        !            29:        int callee_idx;         /* index of called function */
        !            30:        Uint32 ret_addr;        /* address after returning from call */
        !            31:        Uint32 caller_addr;     /* remove informational caller address */
        !            32:        Uint32 callee_addr;     /* remove informational callee address */
        !            33:        counters_t all;         /* totals including everything called code does */
        !            34:        counters_t out;         /* totals for subcalls done from callee */
        !            35: } callstack_t;
        !            36: 
        !            37: /* callee/caller information */
        !            38: typedef struct {
        !            39:        calltype_t   flags:8;   /* what kind of call it was */
        !            40:        unsigned int addr:24;   /* address for the caller */
        !            41:        Uint32 calls;           /* number of calls, exclusive */
        !            42:        counters_t all;         /* totals including everything called code does */
        !            43:        counters_t own;         /* totals excluding called code (=sum(all-out)) */
        !            44: } caller_t;
        !            45: 
        !            46: typedef struct {
        !            47:        Uint32 addr;            /* called address */
        !            48:        int count;              /* number of callers */
        !            49:        caller_t *callers;      /* who called this address */
        !            50: } callee_t;
        !            51: 
        !            52: /* impossible PC value, for unitialized PC values */
        !            53: #define PC_UNDEFINED 0xFFFFFFFF
        !            54: 
        !            55: typedef struct {
        !            56:        int sites;              /* number of symbol callsites */
        !            57:        int count;              /* number of items allocated for stack */
        !            58:        int depth;              /* how many callstack calls haven't yet returned */
        !            59:        Uint32 prev_pc;         /* stored previous PC value */
        !            60:        Uint32 return_pc;       /* address for last call return address (speedup) */
        !            61:        callee_t *site;         /* symbol specific caller information */
        !            62:        callstack_t *stack;     /* calls that will return */
        !            63: } callinfo_t;
        !            64: 
        !            65: 
        !            66: /* CPU/DSP memory area statistics */
        !            67: typedef struct {
        !            68:        counters_t counters;    /* counters for this area */
        !            69:        Uint32 lowest, highest; /* active address range within memory area */
        !            70:        int active;             /* number of active addresses */
        !            71:        bool overflow;          /* whether counters overflowed */
        !            72: } profile_area_t;
        !            73: 
        !            74: 
        !            75: /* generic profile caller/callee info functions */
        !            76: extern void Profile_ShowCallers(FILE *fp, int sites, callee_t *callsite, const char * (*addr2name)(Uint32, Uint64 *));
        !            77: extern void Profile_CallStart(int idx, callinfo_t *callinfo, Uint32 prev_pc, calltype_t flag, Uint32 pc, counters_t *totalcost);
        !            78: extern void Profile_FinalizeCalls(callinfo_t *callinfo, counters_t *totalcost, const char* (get_symbol)(Uint32 addr));
        !            79: extern Uint32 Profile_CallEnd(callinfo_t *callinfo, counters_t *totalcost);
        !            80: extern int  Profile_AllocCallinfo(callinfo_t *callinfo, int count, const char *info);
        !            81: extern void Profile_FreeCallinfo(callinfo_t *callinfo);
        !            82: 
        !            83: /* parser helpers */
        !            84: extern void Profile_CpuGetPointers(bool **enabled, Uint32 **disasm_addr);
        !            85: extern void Profile_DspGetPointers(bool **enabled, Uint32 **disasm_addr);
        !            86: extern void Profile_CpuGetCallinfo(callinfo_t **callinfo, const char* (**get_symbol)(Uint32));
        !            87: extern void Profile_DspGetCallinfo(callinfo_t **callinfo, const char* (**get_symbol)(Uint32));
        !            88: 
        !            89: /* internal CPU profile results */
        !            90: extern Uint32 Profile_CpuShowAddresses(Uint32 lower, Uint32 upper, FILE *out);
        !            91: extern void Profile_CpuShowCounts(int show, bool only_symbols);
        !            92: extern void Profile_CpuShowCycles(int show);
        !            93: extern void Profile_CpuShowMisses(int show);
        !            94: extern void Profile_CpuShowStats(void);
        !            95: extern void Profile_CpuShowCallers(FILE *fp);
        !            96: extern void Profile_CpuSave(FILE *out);
        !            97: 
        !            98: /* internal DSP profile results */
        !            99: extern Uint16 Profile_DspShowAddresses(Uint32 lower, Uint32 upper, FILE *out);
        !           100: extern void Profile_DspShowCounts(int show, bool only_symbols);
        !           101: extern void Profile_DspShowCycles(int show);
        !           102: extern void Profile_DspShowStats(void);
        !           103: extern void Profile_DspShowCallers(FILE *fp);
        !           104: extern void Profile_DspSave(FILE *out);
        !           105: 
        !           106: #endif  /* HATARI_PROFILE_PRIV_H */

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.