Skip to content

Commit be1e63a

Browse files
committed
up
1 parent e9e984f commit be1e63a

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

kbe/src/lib/pyscript/pyprofile.cpp

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,16 @@ bool PyProfile::remove(std::string profile)
144144
}
145145

146146
//-------------------------------------------------------------------------------------
147-
void PyProfile::print_stats(const std::string& sort = "time")
147+
void PyProfile::print_stats(const std::string& sort, const std::string& profileName)
148148
{
149+
PyProfile::PROFILES::iterator iter = profiles_.find(profileName.c_str());
150+
if(iter == profiles_.end())
151+
{
152+
return;
153+
}
154+
149155
PyObject* pyRet = PyObject_CallMethod(iter->second.get(), const_cast<char*>("print_stats"),
150-
const_cast<char*>("s"), const_cast<char*>("time"));
156+
const_cast<char*>("s"), const_cast<char*>(sort.c_str()));
151157

152158
if(pyRet)
153159
Py_DECREF(pyRet);

kbe/src/lib/pyscript/pyprofile.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class PyProfile
4444
static void addToStream(std::string profile, MemoryStream* s);
4545
static bool remove(std::string profile);
4646

47-
static void print_stats(const std::string& sort = "time");
47+
static void print_stats(const std::string& sort = "time", const std::string& profileName = "kbengine");
4848

4949
/**
5050
初始化pickler

0 commit comments

Comments
 (0)