当前位置: 首页>>代码示例>>C++>>正文


C++ Profiler类代码示例

本文整理汇总了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
	}
开发者ID:dysonbird,项目名称:3D-Game-Engine-in-C-Plus-Plus,代码行数:21,代码来源:Profiling.cpp

示例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);
            }
        }
    }
开发者ID:changm,项目名称:tessa,代码行数:22,代码来源:avmplusDebugger.cpp

示例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);
    }
}
开发者ID:ninjastone,项目名称:Urho3D,代码行数:24,代码来源:Timer.cpp

示例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));
  }
}
开发者ID:Marshrutka,项目名称:hhvm,代码行数:24,代码来源:event-hook.cpp

示例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;
}
开发者ID:299299,项目名称:NagaGame,代码行数:20,代码来源:Profiler.cpp

示例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);
}
开发者ID:ikavalio,项目名称:honest-profiler,代码行数:5,代码来源:control.cpp

示例7:

	~ProfilerScopeRAII()
	{
		profiler->pop();
	}
开发者ID:ongamex,项目名称:playground,代码行数:4,代码来源:profiler.cpp

示例8: DumpProfiler

void Engine::DumpProfiler()
{
    Profiler* profiler = GetSubsystem<Profiler>();
    if (profiler)
        LOGRAW(profiler->GetData(true, true) + "\n");
}
开发者ID:LuisAntonRebollo,项目名称:Urho3D,代码行数:6,代码来源:Engine.cpp

示例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();
	}
开发者ID:dysonbird,项目名称:3D-Game-Engine-in-C-Plus-Plus,代码行数:15,代码来源:Profiling.cpp

示例10: scoped_tic

 scoped_tic(Profiler &prof, const std::string &name)
     : prof(prof), name(name)
 {
     prof.tic(name);
 }
开发者ID:HongLi15,项目名称:amgcl,代码行数:5,代码来源:profiler.hpp

示例11: HHVM_FUNCTION

void HHVM_FUNCTION(xhprof_frame_end) {
  Profiler *prof = ThreadInfo::s_threadInfo->m_profiler;
  if (prof) {
    prof->endFrame(nullptr, nullptr);
  }
}
开发者ID:LouisRenWeiWei,项目名称:hhvm,代码行数:6,代码来源:ext_xhprof.cpp

示例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 : 

//.........这里部分代码省略.........
开发者ID:dysonbird,项目名称:3D-Game-Engine-in-C-Plus-Plus,代码行数:101,代码来源:Profiling.cpp

示例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);
//.........这里部分代码省略.........
开发者ID:Aishinjiaolo,项目名称:OGC,代码行数:101,代码来源:main.cpp

示例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();
        }
    }
}
开发者ID:RobertoMalatesta,项目名称:AtomicGameEngine,代码行数:84,代码来源:DebugHud.cpp

示例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;
}
开发者ID:StevenNicklin,项目名称:robocup,代码行数:92,代码来源:SeeThinkThread.cpp


注:本文中的Profiler类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。