diff --git a/core/logic/Profiler.cpp b/core/logic/Profiler.cpp index ad453bae..e377010d 100644 --- a/core/logic/Profiler.cpp +++ b/core/logic/Profiler.cpp @@ -1,5 +1,5 @@ /** - * vim: set ts=4 : + * vim: set ts=4 sw=4 tw=99 noet : * ============================================================================= * SourceMod * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. @@ -465,7 +465,7 @@ void ProfileReport::SaveAtom(const prof_atom_t &atom) { double atom_time; char full_name[256]; - prof_atom_report_t **pReport, *report; + prof_atom_report_t *report; if (atom.atom_type == SP_PROF_NATIVES) { @@ -487,7 +487,7 @@ void ProfileReport::SaveAtom(const prof_atom_t &atom) atom_time = CalcAtomTime(atom); - if ((pReport = m_ReportLookup.retrieve(full_name)) == NULL) + if (!m_ReportLookup.retrieve(full_name, &report)) { report = new prof_atom_report_t; @@ -502,8 +502,6 @@ void ProfileReport::SaveAtom(const prof_atom_t &atom) } else { - report = *pReport; - if (atom_time > report->max_time) { report->max_time = atom_time; diff --git a/core/logic/Profiler.h b/core/logic/Profiler.h index f15dc6c9..a3317f69 100644 --- a/core/logic/Profiler.h +++ b/core/logic/Profiler.h @@ -1,5 +1,5 @@ /** - * vim: set ts=4 : + * vim: set ts=4 sw=4 tw=99 noet : * ============================================================================= * SourceMod * Copyright (C) 2004-2008 AlliedModders LLC. All rights reserved. @@ -34,9 +34,9 @@ #include #include -#include #include #include +#include #include #include "common_logic.h" #include @@ -72,6 +72,11 @@ struct prof_atom_report_t unsigned int num_calls; /* Number of invocations */ double min_time; /* Min time spent in one call, in s */ double max_time; /* Max time spent in one call, in s */ + + static inline bool matches(const char *name, const prof_atom_report_t *report) + { + return strcmp(report->atom_name, name) == 0; + } }; class ProfileReport @@ -84,7 +89,7 @@ public: prof_atom_report_t *GetReport(size_t i); void Clear(); private: - KTrie m_ReportLookup; + NameHashSet m_ReportLookup; CVector m_Reports; };