xref: /haiku/src/apps/cortex/support/ProfileTarget.h (revision 1d9d47fc72028bb71b5f232a877231e59cfe2438)
1 // ProfileTarget.h
2 // e.moon 19may99
3 //
4 // A bare-bones profiling tool.
5 
6 #ifndef __EMOON_PROFILETARGET_H__
7 #define __EMOON_PROFILETARGET_H__
8 
9 #include <map>
10 
11 #include <String.h>
12 
13 #include "cortex_defs.h"
14 __BEGIN_CORTEX_NAMESPACE
15 
16 class ProfileTarget {
17 public:					// ctor/dtor
18 	virtual ~ProfileTarget();
19 	ProfileTarget();
20 
21 public:					// user operations
22 	void clear();
23 	void dump() const;
24 
25 public:					// profile-source operations
26 	inline void addBlockEntry(const char* blockName, bigtime_t elapsed);
27 
28 public:
29 	struct block_entry {
30 		block_entry() : elapsed(0), count(0), name(0) {}
31 
32 		bigtime_t		elapsed;
33 		uint32			count;
34 		const char*		name;
35 	};
36 
37 private:					// implementation
38 
39 	typedef map<BString, block_entry> block_entry_map;
40 	block_entry_map		m_blockEntryMap;
41 };
42 
43 //bool operator<(const ProfileTarget::block_entry& a, const ProfileTarget::block_entry& b);
44 
45 __END_CORTEX_NAMESPACE
46 #endif /* __EMOON_PROFILETARGET_H__ */
47