let profiler trace 'get member' calls, because I suspect they might be slow (linear string lookup)

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@1244 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2008-12-11 16:28:17 +00:00
parent 010c8d8d0b
commit dc2028a956
3 changed files with 28 additions and 0 deletions
+10
View File
@@ -70,6 +70,8 @@ class FunctionProfile : public IntrusivePtrBase<FunctionProfile> {
String name;
ProfileTime time_ticks;
UInt calls;
/// for each id, called children
/** we (ab)use the fact that all pointers are even to store both pointers and ids */
map<size_t,FunctionProfileP> children;
/// The children, sorted by time
@@ -90,8 +92,16 @@ const FunctionProfile& profile_aggregated(int level = 1);
/// Profile a single function call
class Profiler {
public:
/// Log the fact that the function function_name is entered, ends when profiler goes out of scope.
/** Time between the construction of Timer and the construction of Profiler is excluded from ALL profiles.
*/
Profiler(Timer& timer, Variable function_name);
/// As above, but with a constant name
Profiler(Timer& timer, const Char* function_name);
/// As above, but using a function object instead of a name,
/** if we haven't seen the object before, it gets the given name. */
Profiler(Timer& timer, void* function_object, const String& function_name);
/// Log the fact that the function is left
~Profiler();
private:
Timer& timer;