Switch Profiler off KTrie (bug 5884 part 6, r=ds).

This commit is contained in:
David Anderson 2013-08-25 11:59:48 -07:00
parent ebe9ee8114
commit 0b8e2fd5c9
2 changed files with 11 additions and 8 deletions

View File

@ -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;

View File

@ -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 <sp_vm_api.h>
#include <sm_platform.h>
#include <sm_trie_tpl.h>
#include <sh_vector.h>
#include <sh_stack.h>
#include <sm_namehashset.h>
#include <stdio.h>
#include "common_logic.h"
#include <IRootConsoleMenu.h>
@ -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<prof_atom_report_t *> m_ReportLookup;
NameHashSet<prof_atom_report_t *> m_ReportLookup;
CVector<prof_atom_report_t *> m_Reports;
};