HXCPP Profiler won't create log file

200 views Asked by At

I am using Haxe for a game and compiling for the C++ target using HXCPP. I am trying to get the built-in profiler to work (cpp.vm.Profiler), but I cannot get it to create a dump file. My code is as simple as that :

if(Input.check(Key.P))
    cpp.vm.Profiler.start("profiler.txt");
if(Input.check(Key.M))
    cpp.vm.Profiler.stop();

I use HaxePunk for the input, and I assert that the profiler calls are indeed being executed (I made sure using a couple trace calls). I use defines HXCPP_STACK_TRACE and HXCPP_PROFILER for the compilation.

Am I doing anything wrong, or missing anything ?

EDIT : here is some code that when compiled using haxe -D HXCPP_PROFILER -D HXCPP_STACK_TRACE -main Main -cpp test, doesn't actually create any noticeable "profiler.txt" file :

class Main
{
    static public function main()
    {
        var bleh = haxe.Timer.stamp();
        cpp.vm.Profiler.start("profiler.txt");
        while(haxe.Timer.stamp() - bleh < 5.)
        {
            // Do something I guess
            Math.cos(haxe.Timer.stamp());
        }
        cpp.vm.Profiler.stop();
    }
}
1

There are 1 answers

2
Thomas On

Relevant bug report to hxcpp: #580.

Apparently this was fixed on 17 May 2017 in this commit. The fix should be in the next hxcpp version after 3.4.64.