|
|
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 {
21: Uint64 calls, count, cycles, misses;
22: } counters_t;
23:
24: typedef struct {
25: int callee_idx; /* index of called function */
26: Uint32 ret_addr; /* address after returning from call */
27: Uint32 caller_addr; /* remove informational caller address */
28: Uint32 callee_addr; /* remove informational callee address */
29: counters_t all; /* totals including everything called code does */
30: counters_t out; /* totals for subcalls done from callee */
31: } callstack_t;
32:
33: /* callee/caller information */
34: typedef struct {
35: calltype_t flags:8; /* what kind of call it was */
36: unsigned int addr:24; /* address for the caller */
37: Uint32 calls; /* number of calls, exclusive */
38: counters_t all; /* totals including everything called code does */
39: counters_t own; /* totals excluding called code (=sum(all-out)) */
40: } caller_t;
41:
42: typedef struct {
43: Uint32 addr; /* called address */
44: int count; /* number of callers */
45: caller_t *callers; /* who called this address */
46: } callee_t;
47:
48: /* impossible PC value, for unitialized PC values */
49: #define PC_UNDEFINED 0xFFFFFFFF
50:
51: typedef struct {
52: int sites; /* number of symbol callsites */
53: int count; /* number of items allocated for stack */
54: int depth; /* how many callstack calls haven't yet returned */
55: Uint32 prev_pc; /* stored previous PC value */
56: Uint32 return_pc; /* address for last call return address (speedup) */
57: callee_t *site; /* symbol specific caller information */
58: callstack_t *stack; /* calls that will return */
59: } callinfo_t;
60:
61:
62: /* CPU/DSP memory area statistics */
63: typedef struct {
64: counters_t counters; /* counters for this area */
65: Uint32 lowest, highest; /* active address range within memory area */
66: int active; /* number of active addresses */
67: bool overflow; /* whether counters overflowed */
68: } profile_area_t;
69:
70:
71: /* generic profile caller/callee info functions */
72: extern void Profile_ShowCallers(FILE *fp, int sites, callee_t *callsite, const char * (*addr2name)(Uint32, Uint64 *));
73: extern void Profile_CallStart(int idx, callinfo_t *callinfo, Uint32 prev_pc, calltype_t flag, Uint32 pc, counters_t *totalcost);
74: extern void Profile_FinalizeCalls(callinfo_t *callinfo, counters_t *totalcost, const char* (get_symbol)(Uint32 addr));
75: extern Uint32 Profile_CallEnd(callinfo_t *callinfo, counters_t *totalcost);
76: extern int Profile_AllocCallinfo(callinfo_t *callinfo, int count, const char *info);
77: extern void Profile_FreeCallinfo(callinfo_t *callinfo);
1.1.1.2 ! root 78: extern bool Profile_LoopReset(void);
1.1 root 79:
80: /* parser helpers */
81: extern void Profile_CpuGetPointers(bool **enabled, Uint32 **disasm_addr);
82: extern void Profile_DspGetPointers(bool **enabled, Uint32 **disasm_addr);
83: extern void Profile_CpuGetCallinfo(callinfo_t **callinfo, const char* (**get_symbol)(Uint32));
84: extern void Profile_DspGetCallinfo(callinfo_t **callinfo, const char* (**get_symbol)(Uint32));
85:
86: /* internal CPU profile results */
87: extern Uint32 Profile_CpuShowAddresses(Uint32 lower, Uint32 upper, FILE *out);
88: extern void Profile_CpuShowCounts(int show, bool only_symbols);
89: extern void Profile_CpuShowCycles(int show);
90: extern void Profile_CpuShowMisses(int show);
91: extern void Profile_CpuShowStats(void);
92: extern void Profile_CpuShowCallers(FILE *fp);
93: extern void Profile_CpuSave(FILE *out);
94:
95: /* internal DSP profile results */
96: extern Uint16 Profile_DspShowAddresses(Uint32 lower, Uint32 upper, FILE *out);
97: extern void Profile_DspShowCounts(int show, bool only_symbols);
98: extern void Profile_DspShowCycles(int show);
99: extern void Profile_DspShowStats(void);
100: extern void Profile_DspShowCallers(FILE *fp);
101: extern void Profile_DspSave(FILE *out);
102:
103: #endif /* HATARI_PROFILE_PRIV_H */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.