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

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: 
1.1.1.2   root       11: typedef struct {
                     12:        char *filename;         /* where to write loop info */
                     13:        FILE *fp;               /* pointer modified by CPU & DSP code */
                     14:        Uint32 cpu_limit;       /* max limit for profiled CPU loop size */
                     15:        Uint32 dsp_limit;       /* max limit for profiled DSP loop size */
                     16: } profile_loop_t;
                     17: 
                     18: extern profile_loop_t profile_loop;
1.1       root       19: 
                     20: typedef struct {
1.1.1.3   root       21:        Uint64 calls, count, cycles; /* common counters between CPU & DSP */
                     22:        Uint64 i_misses, d_hits;     /* CPU specific counters */
                     23:        Uint64 cycles_diffs;         /* DSP specific counter, not updated at run-time */
1.1       root       24: } counters_t;
                     25: 
                     26: typedef struct {
                     27:        int callee_idx;         /* index of called function */
                     28:        Uint32 ret_addr;        /* address after returning from call */
                     29:        Uint32 caller_addr;     /* remove informational caller address */
                     30:        Uint32 callee_addr;     /* remove informational callee address */
                     31:        counters_t all;         /* totals including everything called code does */
                     32:        counters_t out;         /* totals for subcalls done from callee */
                     33: } callstack_t;
                     34: 
                     35: /* callee/caller information */
                     36: typedef struct {
1.1.1.4   root       37:        calltype_t flags;       /* what kind of call it was */
                     38:        Uint32 addr;            /* address for the caller */
1.1       root       39:        Uint32 calls;           /* number of calls, exclusive */
                     40:        counters_t all;         /* totals including everything called code does */
                     41:        counters_t own;         /* totals excluding called code (=sum(all-out)) */
                     42: } caller_t;
                     43: 
                     44: typedef struct {
                     45:        Uint32 addr;            /* called address */
                     46:        int count;              /* number of callers */
                     47:        caller_t *callers;      /* who called this address */
                     48: } callee_t;
                     49: 
                     50: /* impossible PC value, for unitialized PC values */
                     51: #define PC_UNDEFINED 0xFFFFFFFF
                     52: 
                     53: typedef struct {
                     54:        int sites;              /* number of symbol callsites */
                     55:        int count;              /* number of items allocated for stack */
                     56:        int depth;              /* how many callstack calls haven't yet returned */
                     57:        Uint32 prev_pc;         /* stored previous PC value */
                     58:        Uint32 return_pc;       /* address for last call return address (speedup) */
                     59:        callee_t *site;         /* symbol specific caller information */
                     60:        callstack_t *stack;     /* calls that will return */
                     61: } callinfo_t;
                     62: 
                     63: 
                     64: /* CPU/DSP memory area statistics */
                     65: typedef struct {
                     66:        counters_t counters;    /* counters for this area */
                     67:        Uint32 lowest, highest; /* active address range within memory area */
                     68:        int active;             /* number of active addresses */
                     69:        bool overflow;          /* whether counters overflowed */
                     70: } profile_area_t;
                     71: 
                     72: 
                     73: /* generic profile caller/callee info functions */
                     74: extern void Profile_ShowCallers(FILE *fp, int sites, callee_t *callsite, const char * (*addr2name)(Uint32, Uint64 *));
                     75: extern void Profile_CallStart(int idx, callinfo_t *callinfo, Uint32 prev_pc, calltype_t flag, Uint32 pc, counters_t *totalcost);
1.1.1.5 ! root       76: extern void Profile_FinalizeCalls(callinfo_t *callinfo, counters_t *totalcost, const char* (get_symbol)(Uint32, symtype_t));
1.1       root       77: extern Uint32 Profile_CallEnd(callinfo_t *callinfo, counters_t *totalcost);
                     78: extern int  Profile_AllocCallinfo(callinfo_t *callinfo, int count, const char *info);
                     79: extern void Profile_FreeCallinfo(callinfo_t *callinfo);
1.1.1.2   root       80: extern bool Profile_LoopReset(void);
1.1       root       81: 
                     82: /* parser helpers */
                     83: extern void Profile_CpuGetPointers(bool **enabled, Uint32 **disasm_addr);
                     84: extern void Profile_DspGetPointers(bool **enabled, Uint32 **disasm_addr);
1.1.1.5 ! root       85: extern void Profile_CpuGetCallinfo(callinfo_t **callinfo, const char* (**get_symbol)(Uint32, symtype_t));
        !            86: extern void Profile_DspGetCallinfo(callinfo_t **callinfo, const char* (**get_symbol)(Uint32, symtype_t));
        !            87: 
        !            88: typedef enum {
        !            89:        PAGING_DISABLED,
        !            90:        PAGING_ENABLED
        !            91: } paging_t;
1.1       root       92: 
                     93: /* internal CPU profile results */
1.1.1.5 ! root       94: extern Uint32 Profile_CpuShowAddresses(Uint32 lower, Uint32 upper, FILE *out, paging_t use_paging);
1.1       root       95: extern void Profile_CpuShowCounts(int show, bool only_symbols);
                     96: extern void Profile_CpuShowCycles(int show);
1.1.1.3   root       97: extern void Profile_CpuShowInstrMisses(int show);
                     98: extern void Profile_CpuShowDataHits(int show);
                     99: extern void Profile_CpuShowCaches(void);
1.1       root      100: extern void Profile_CpuShowStats(void);
                    101: extern void Profile_CpuShowCallers(FILE *fp);
                    102: extern void Profile_CpuSave(FILE *out);
                    103: 
                    104: /* internal DSP profile results */
1.1.1.5 ! root      105: extern Uint16 Profile_DspShowAddresses(Uint32 lower, Uint32 upper, FILE *out, paging_t use_paging);
1.1       root      106: extern void Profile_DspShowCounts(int show, bool only_symbols);
                    107: extern void Profile_DspShowCycles(int show);
                    108: extern void Profile_DspShowStats(void);
                    109: extern void Profile_DspShowCallers(FILE *fp);
                    110: extern void Profile_DspSave(FILE *out);
                    111: 
                    112: #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.