本文整理汇总了C++中Profiler类的典型用法代码示例。如果您正苦于以下问题:C++ Profiler类的具体用法?C++ Profiler怎么用?C++ Profiler使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Profiler类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
/******************************************************************************
Function : ~ScopedTimer
Description : Destructor of scoped timer
Input :
Output :
Return Value :
History :
Author : Vinod VM
Modification : Created function
******************************************************************************/
ScopedTimer::~ScopedTimer()
{
double TimeInMS = mStart.GetTickDifferenceinMS();
g_Profiler.AddTimingData(mName, TimeInMS);
#if defined(_DEBUG)
CONSOLE_PRINT("Scoped timer %s is Ended, TimeTaken in MS is %f", mName == NULL ? "UnknownTimer" : mName, TimeInMS);
#endif
}
示例2: AvmAssert
void Debugger::debugFile(Stringp filename)
{
AvmAssert( core->callStack != 0 );
if (!core->callStack)
return;
AvmAssert(filename != 0);
Stringp prev = core->callStack->filename();
core->callStack->set_filename(filename);
// filename changed
if (prev != filename)
{
Profiler* profiler = core->profiler();
Sampler* s = core->get_sampler();
if (profiler && profiler->profilingDataWanted && !(s && s->sampling()))
{
profiler->sendDebugFileURL(filename);
}
}
}
示例3: BeginFrame
void Time::BeginFrame(float timeStep)
{
++frameNumber_;
if (!frameNumber_)
++frameNumber_;
timeStep_ = timeStep;
Profiler* profiler = GetSubsystem<Profiler>();
if (profiler)
profiler->BeginFrame();
{
PROFILE(BeginFrame);
// Frame begin event
using namespace BeginFrame;
VariantMap& eventData = GetEventDataMap();
eventData[P_FRAMENUMBER] = frameNumber_;
eventData[P_TIMESTEP] = timeStep_;
SendEvent(E_BEGINFRAME, eventData);
}
}
示例4: runUserProfilerOnFunctionEnter
void EventHook::onFunctionEnter(const ActRec* ar, int funcType, ssize_t flags) {
// Xenon
if (flags & RequestInjectionData::XenonSignalFlag) {
Xenon::getInstance().log(Xenon::EnterSample);
}
// User profiler
if (flags & RequestInjectionData::EventHookFlag) {
if (shouldRunUserProfiler(ar->func())) {
runUserProfilerOnFunctionEnter(ar);
}
Profiler* profiler = ThreadInfo::s_threadInfo->m_profiler;
if (profiler != nullptr &&
!(profiler->shouldSkipBuiltins() && ar->func()->isBuiltin())) {
begin_profiler_frame(profiler,
GetFunctionNameForProfiler(ar->func(), funcType));
}
}
// Debugger hook
if (flags & RequestInjectionData::DebuggerHookFlag) {
DEBUGGER_ATTACHED_ONLY(phpDebuggerFuncEntryHook(ar));
}
}
示例5: get_child
ProfilerBlock* ProfilerBlock::get_child( const char* name )
{
uint32_t num = numChildren_;
for (uint32_t i=0; i<num; ++i)
{
ProfilerBlock* child = children_[i];
if(name == child->name_)
return child;
}
for (uint32_t i=0; i<num; ++i)
{
ProfilerBlock* child = children_[i];
if(!strcmp(name, child->name_))
return child;
}
ProfilerBlock* newBlock = g_profiler.alloc_block(name);
children_[numChildren_++] = newBlock;
newBlock->parent_ = this;
return newBlock;
}
示例6: Java_com_insightfullogic_honest_1profiler_core_control_Agent_setMaxFramesToCapture
JNIEXPORT void JNICALL Java_com_insightfullogic_honest_1profiler_core_control_Agent_setMaxFramesToCapture(JNIEnv *env, jclass klass, jint maxFramesToCapture) {
Profiler *prof = getProfiler();
prof->setMaxFramesToCapture(maxFramesToCapture);
}
示例7:
~ProfilerScopeRAII()
{
profiler->pop();
}
示例8: DumpProfiler
void Engine::DumpProfiler()
{
Profiler* profiler = GetSubsystem<Profiler>();
if (profiler)
LOGRAW(profiler->GetData(true, true) + "\n");
}
示例9: PrintAccumulators
/******************************************************************************
Function : PrintAccumulators
Description : Print accumulators by calling the global profiler variable
Input :
Output :
Return Value :
History :
Author : Vinod VM
Modification : Created function
******************************************************************************/
void PrintAccumulators()
{
g_Profiler.PrintTimingData();
}
示例10: scoped_tic
scoped_tic(Profiler &prof, const std::string &name)
: prof(prof), name(name)
{
prof.tic(name);
}
示例11: HHVM_FUNCTION
void HHVM_FUNCTION(xhprof_frame_end) {
Profiler *prof = ThreadInfo::s_threadInfo->m_profiler;
if (prof) {
prof->endFrame(nullptr, nullptr);
}
}
示例12: mName
namespace Engine
{
Profiler g_Profiler;
/******************************************************************************
Function : ScopedTimer
Description : constructor of scoped timer
Input : const char *i_pName
Output :
Return Value :
History :
Author : Vinod VM
Modification : Created function
******************************************************************************/
ScopedTimer::ScopedTimer(const char *i_pName):
mName(i_pName)
{
mStart.CalcCurrentTick();
if (i_pName == NULL)
{
mName = "UnknownTimer";
}
#if defined(_DEBUG)
CONSOLE_PRINT("Scoped timer %s is started", mName);
#endif
}
/******************************************************************************
Function : ~ScopedTimer
Description : Destructor of scoped timer
Input :
Output :
Return Value :
History :
Author : Vinod VM
Modification : Created function
******************************************************************************/
ScopedTimer::~ScopedTimer()
{
double TimeInMS = mStart.GetTickDifferenceinMS();
g_Profiler.AddTimingData(mName, TimeInMS);
#if defined(_DEBUG)
CONSOLE_PRINT("Scoped timer %s is Ended, TimeTaken in MS is %f", mName == NULL ? "UnknownTimer" : mName, TimeInMS);
#endif
}
/******************************************************************************
Function : Accumulator
Description : accumulator constructor that initilizes the Count, Max,
Min and Sum
Input :
Output :
Return Value :
History :
Author : Vinod VM
Modification : Created function
******************************************************************************/
Accumulator::Accumulator():
mCount(0),
mMax(0.0f),
mMin(MAXLONG),
mSum(0.0f)
{
}
/******************************************************************************
Function : Accumulator
Description : accumulator constructor that initilizes the Count, Max,
Min and Sum with input Time difference
Input : double i_TimeDifferenceinMS
Output :
Return Value :
History :
Author : Vinod VM
Modification : Created function
******************************************************************************/
Accumulator::Accumulator(double i_TimeDifferenceinMS):
mMax(i_TimeDifferenceinMS),
mMin(i_TimeDifferenceinMS),
mSum(i_TimeDifferenceinMS)
{
mCount = 1;
}
/******************************************************************************
Function : AddTimingData
Description : Adds timing data with name and tick difference
Input : const std::string i_pTimerName, const double i_TimeDifferenceinMS
Output :
Return Value :
//.........这里部分代码省略.........
示例13: main
int main() {
// profiler
Profiler profiler;
profiler.start((char*)"main");
// random generate 1d vector
// assign maximum size =>
const int max = 100;
vector<double> main_1d_points(max);
srand(time(NULL));
for (int i = 0; i < max; i++) {
main_1d_points[i] = rand() % 100;
};
// transform to Points, then sorting
Points main_points;
main_points.parse_1d_points_from(main_1d_points);
main_points.sort_by_y();
main_points.dump();
Points center;
center.create_center_from(main_points);
center.dump();
// create a set of points
Point a, b, c, d, e, f, g, h;
a.set_point( 0, 0);
b.set_point( 5, 0);
c.set_point( 5, 5);
d.set_point( 0, 5);
e.set_point(-5, 5);
f.set_point(-5, 0);
g.set_point(-5, -5);
h.set_point( 0, -5);
// form each segment
Segment ab, bc, cd, de, ef, fg, gh, ha;
ab.set_segment(&a, &b);
bc.set_segment(&b, &c);
cd.set_segment(&c, &d);
de.set_segment(&d, &e);
ef.set_segment(&e, &f);
fg.set_segment(&f, &g);
gh.set_segment(&g, &h);
ha.set_segment(&h, &a);
// try segment copy
Segment copy_test;
copy_test.copy(ab);
printf("copy segment:\n");
copy_test.dump();
copy_test.free();
// form a set of segments
Segments all;
all.append(&ab);
all.append(&bc);
all.append(&cd);
all.append(&de);
all.append(&ef);
all.append(&fg);
all.append(&gh);
all.append(&ha);
all.dump();
// set the set of segments to a polygon
// and test polygon function
Polygon polygon1;
polygon1.set_polygon(&all);
polygon1.dump();
printf("(%d) segments in this polygon\n", polygon1.get_segment_number());
printf("center point of this polygon is (%f, %f)\n",
polygon1.get_center().get_gx(),
polygon1.get_center().get_gy());
// set the set of segments to another polygon
// yet, they reference the same segments set
printf("\nthis is polygon2\n");
Polygon polygon2;
polygon2.set_polygon(&all);
polygon2.dump();
// try polygon copy
printf("\nthis is polygon3\n");
Polygon polygon3;
polygon3.copy(polygon2);
polygon3.dump();
// append the polygons into a set of polygons
Polygons polygons;
polygons.append(&polygon1);
polygons.append(&polygon3);
// set segment function and loop all polygons set
ktSetSegmentFunction(grow_45_degree);
ktLoopSegment(&polygons);
//.........这里部分代码省略.........
示例14: Update
void DebugHud::Update()
{
Graphics* graphics = GetSubsystem<Graphics>();
Renderer* renderer = GetSubsystem<Renderer>();
if (!renderer || !graphics)
return;
// Ensure UI-elements are not detached
if (!statsText_->GetParent())
{
UI* ui = GetSubsystem<UI>();
UIElement* uiRoot = ui->GetRoot();
uiRoot->AddChild(statsText_);
uiRoot->AddChild(modeText_);
uiRoot->AddChild(profilerText_);
}
if (statsText_->IsVisible())
{
unsigned primitives, batches;
if (!useRendererStats_)
{
primitives = graphics->GetNumPrimitives();
batches = graphics->GetNumBatches();
}
else
{
primitives = renderer->GetNumPrimitives();
batches = renderer->GetNumBatches();
}
String stats;
stats.AppendWithFormat("Triangles %u\nBatches %u\nViews %u\nLights %u\nShadowmaps %u\nOccluders %u",
primitives,
batches,
renderer->GetNumViews(),
renderer->GetNumLights(true),
renderer->GetNumShadowMaps(true),
renderer->GetNumOccluders(true));
if (!appStats_.Empty())
{
stats.Append("\n");
for (HashMap<String, String>::ConstIterator i = appStats_.Begin(); i != appStats_.End(); ++i)
stats.AppendWithFormat("\n%s %s", i->first_.CString(), i->second_.CString());
}
statsText_->SetText(stats);
}
if (modeText_->IsVisible())
{
String mode;
mode.AppendWithFormat("Tex:%s Mat:%s Spec:%s Shadows:%s Size:%i Quality:%s Occlusion:%s Instancing:%s API:%s",
qualityTexts[renderer->GetTextureQuality()],
qualityTexts[renderer->GetMaterialQuality()],
renderer->GetSpecularLighting() ? "On" : "Off",
renderer->GetDrawShadows() ? "On" : "Off",
renderer->GetShadowMapSize(),
shadowQualityTexts[renderer->GetShadowQuality()],
renderer->GetMaxOccluderTriangles() > 0 ? "On" : "Off",
renderer->GetDynamicInstancing() ? "On" : "Off",
graphics->GetApiName().CString());
modeText_->SetText(mode);
}
Profiler* profiler = GetSubsystem<Profiler>();
if (profiler)
{
if (profilerTimer_.GetMSec(false) >= profilerInterval_)
{
profilerTimer_.Reset();
if (profilerText_->IsVisible())
{
String profilerOutput = profiler->GetData(false, false, profilerMaxDepth_);
profilerText_->SetText(profilerOutput);
}
profiler->BeginInterval();
}
}
}
示例15: Profiler
/*! @brief The sense->move main loop
When signalled the thread will quickly grab the new sensor data, compute a response,
and then send the commands to the actionators.
Note that you can not safely use the job interface in this thread, if you need to add
jobs provide a process function for this thread, and *another* process for the behaviour
thread which creates the jobs.
*/
void SeeThinkThread::run()
{
#if DEBUG_VERBOSITY > 0
debug << "SeeThinkThread::run()" << endl;
#endif
#ifdef THREAD_SEETHINK_PROFILE
Profiler prof = Profiler("SeeThinkThread");
#endif
int err = 0;
while (err == 0 && errno != EINTR)
{
try
{
#if defined(TARGET_IS_NAOWEBOTS) or (not defined(USE_VISION))
wait();
#endif
#ifdef USE_VISION
m_nubot->m_platform->updateImage();
*(m_nubot->m_io) << m_nubot; //<! Raw IMAGE STREAMING (TCP)
#endif
#ifdef THREAD_SEETHINK_PROFILE
prof.start();
#endif
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------
#ifdef USE_VISION
m_nubot->m_vision->ProcessFrame(Blackboard->Image, Blackboard->Sensors, Blackboard->Actions, Blackboard->Objects);
#ifdef THREAD_SEETHINK_PROFILE
prof.split("vision");
#endif
#endif
double current_time = Blackboard->Sensors->GetTimestamp();
Blackboard->TeamInfo->UpdateTime(current_time);
Blackboard->GameInfo->UpdateTime(current_time);
m_logrecorder->WriteData(Blackboard);
#ifdef USE_LOCALISATION
m_nubot->m_localisation->process(Blackboard->Sensors, Blackboard->Objects, Blackboard->GameInfo, Blackboard->TeamInfo);
#ifdef THREAD_SEETHINK_PROFILE
prof.split("localisation");
#endif
#endif
#if defined(USE_BEHAVIOUR)
m_nubot->m_behaviour->process(Blackboard->Jobs, Blackboard->Sensors, Blackboard->Actions, Blackboard->Objects, Blackboard->GameInfo, Blackboard->TeamInfo);
#ifdef THREAD_SEETHINK_PROFILE
prof.split("behaviour");
#endif
#endif
#if DEBUG_VERBOSITY > 0
Blackboard->Jobs->summaryTo(debug);
#endif
#ifdef USE_VISION
m_nubot->m_vision->process(Blackboard->Jobs) ; //<! Networking for Vision
m_nubot->m_platform->process(Blackboard->Jobs, m_nubot->m_io); //<! Networking for Platform
#ifdef THREAD_SEETHINK_PROFILE
prof.split("vision_jobs");
#endif
#endif
#ifdef USE_MOTION
m_nubot->m_motion->process(Blackboard->Jobs);
#ifdef THREAD_SEETHINK_PROFILE
prof.split("motion_jobs");
#endif
#endif
// -----------------------------------------------------------------------------------------------------------------------------------------------------------------
#ifdef THREAD_SEETHINK_PROFILE
debug << prof;
#endif
}
catch (std::exception& e)
{
m_nubot->unhandledExceptionHandler(e);
}
}
errorlog << "SeeThinkThread is exiting. err: " << err << " errno: " << errno << endl;
}