source: svn/newcon3bcm2_21bu/BSEAV/lib/bprofile/bprofile.h @ 22

Last change on this file since 22 was 22, checked in by phkim, 11 years ago
  1. phkim
  2. newcon3sk 를 kctv 로 브랜치 함
  • Property svn:executable set to *
File size: 4.3 KB
Line 
1/***************************************************************************
2 *     Copyright (c) 2006, Broadcom Corporation
3 *     All Rights Reserved
4 *     Confidential Property of Broadcom Corporation
5 *
6 *  THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE
7 *  AGREEMENT  BETWEEN THE USER AND BROADCOM.  YOU HAVE NO RIGHT TO USE OR
8 *  EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT.
9 *
10 * $brcm_Workfile: bprofile.h $
11 * $brcm_Revision: 13 $
12 * $brcm_Date: 12/14/06 4:36p $
13 *
14 * Module Description:
15 *
16 * Embeddeble profiler library
17 *
18 * Revision History:
19 *
20 * $brcm_Log: /BSEAV/lib/bprofile/bprofile.h $
21 *
22 * 13   12/14/06 4:36p vsilyaev
23 * PR 25997: Added more run-time options
24 *
25 * 12   12/11/06 6:21p vsilyaev
26 * PR 25997: Added mode to eleminate estimated overhead of instrumented
27 * code
28 *
29 * 11   12/11/06 12:45p vsilyaev
30 * PR 25997: Added calibrate routine
31 *
32 * 10   12/9/06 12:04p vsilyaev
33 * PR 25997: Improved posprocessing of multi-thread profile data
34 *
35 * 9   12/8/06 7:23p vsilyaev
36 * PR 25997: added option to limit number of output entries
37 *
38 * 8   12/7/06 2:49p vsilyaev
39 * PR 25997: Don't enable perfrormance counters
40 *
41 * 7   12/7/06 2:43p vsilyaev
42 * PR 25997: Added fixes for 3.4 GCC compiler
43 *
44 * 6   12/5/06 4:31p vsilyaev
45 * PR 25997: Added MIPS performance counters
46 *
47 * 5   12/5/06 12:00p vsilyaev
48 * PR 25997: Added faster, single threaded, probe routine
49 *
50 * 4   11/30/06 8:33p vsilyaev
51 * PR 25997: Use atomic variable to prevent missing data
52 *
53 * 3   11/28/06 4:48p vsilyaev
54 * PR 25997: Added multithreaded profiling
55 *
56 * 2   11/20/06 4:54p vsilyaev
57 * PR 25997: Decoupled profiling and symbol table
58 *
59 * 1   11/16/06 5:24p vsilyaev
60 * PR 25997: Embeddable profiler
61 *
62 *******************************************************************************/
63#ifndef __BPROFILE_H__
64#define __BPROFILE_H__
65
66/* #define      BPROFILE_CFG_SINGLE_THREAD      1  */
67
68/* #define      BPROFILE_CFG_PERF_COUNTER       1  */
69
70#if BPROFILE_CFG_PERF_COUNTER
71#include  "bperf_counter.h"
72#endif
73
74#ifdef __cplusplus
75extern "C"
76{
77#endif
78
79typedef struct bprofile_sample{
80        unsigned time;
81#if BPROFILE_CFG_PERF_COUNTER
82        unsigned counters[BPROFILE_CFG_PERF_COUNTER];
83#endif
84}bprofile_sample;
85
86typedef struct bprofile_entry {
87#ifndef BPROFILE_CFG_SINGLE_THREAD
88        unsigned event_0;
89#endif
90        unsigned addr;
91        bprofile_sample sample;
92} bprofile_entry;
93
94#define B_PROFILE_EVENT_ENTER   0
95#define B_PROFILE_EVENT_EXIT    1
96#define B_PROFILE_EVENT_MASK 0x03
97
98typedef struct bprofile_probe_info {
99        bprofile_sample overhead; /* overhewad associated with bprofile samping */
100} bprofile_probe_info;
101
102typedef const void *bprofile_thread_id;
103typedef struct bprofile_sys_iface {
104        /* this is a pointer to a function that is used to convert address to the symbol */
105        const char *(*get_name)(uint32_t addr, char *buf, size_t buf_len);
106        /* this is a pointer to a function that returns opaque handler id from the  stack pointer, NULL means that stack pointer is invalid */
107        bprofile_thread_id (*thread_from_stack)(const uint32_t *stack);
108        const char *(*thread_name)(bprofile_thread_id thread);
109        size_t maxentries; /* maximum number of allocated entries in the profile report */
110        size_t show_entries; /* maximum number of printed entries */
111        bool split_threads; /* print separate report for each thread */
112        bool substract_overhead; /* substract overhead that was cuased by sampling routines */
113        bool call_count; /* print number of function calls */
114        bool preempt_time; /* print preemption time */
115        bool comma_delimited; /* print comma delimited data */
116}bprofile_sys_iface;
117
118/* this function activates acquisiton of profiling data */
119void bprofile_start(bprofile_entry *table, size_t nelem);
120/* this function stops profiling */
121int bprofile_stop(void);
122/* this function generates profiler report from the acquired profiling data */
123size_t bprofile_report_flat(bprofile_entry *table, size_t nentries, const bprofile_sys_iface *sys_iface);
124void bprofile_sys_iface_init(bprofile_sys_iface *sys_iface);
125
126/* this funnction is used to calibrate profiler routines, it returns costs of profiling in ticks */
127unsigned bprofile_calibrate(bprofile_entry *table, size_t nelem);
128/* this function returns current number of accumulated samples */
129int bprofile_poll(void); 
130
131void bprofile_get_info(bprofile_probe_info *info);
132
133#ifdef __cplusplus
134}
135#endif
136
137#endif /* __BPROFILE_H__ */
Note: See TracBrowser for help on using the repository browser.