Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't tracking in infinity loops #195

Open
aantropov opened this issue Sep 30, 2021 · 2 comments
Open

Doesn't tracking in infinity loops #195

aantropov opened this issue Sep 30, 2021 · 2 comments

Comments

@aantropov
Copy link

Hello, is there a way to track code blocks inside the infinity loops?

auto job = JobSystem::Scheduler::CreateJob("Test", []() { while (true) { EASY_BLOCK("Test"); Sleep(100); } }); JobSystem::Scheduler::GetInstance()->Run(job);

The code above is runned in a separated thread and EASY_BLOCK is not tracking Sleep(100).
If you change loop to 'one shot' everything is fine.

@daohu527
Copy link

daohu527 commented Feb 23, 2023

need a EASY_END_BLOCK in the loop.

because EASY_BLOCK use destructor to trigger saving, or explicit end the block


I was wrong before, the for loop triggers the destructor every time it loops. So maybe the save block is not triggered?

@fk-bbraun
Copy link

Hi, had a similar problem. The cause was, that the function containing the infinite loop was only finished after the dumpBlocksToFile() call occured.

To make sure the latest possible dump, try a wrapper object in your main:

class ProfilerWrapper {
public:
    ProfilerWrapper() {
        EASY_PROFILER_ENABLE;
        profiler::startListen();
    }

    ~ProfilerWrapper() {
        profiler::dumpBlocksToFile("prof.prof");
    }
};

int main(int argc, char* argv[]) {
    ProfilerWrapper wp;

    ... do threaded work ...

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants