mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 21:27:01 -04:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user