Skip to content

HacksawStudios/loupe-profiler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

loupe-profiler

A simple instrumentation-based profiler.

Usage

Enable profiling

Profiler.startProfiling(); // Profiling is disabled by default, so you must always do this once before starting to call the profiling functions or they won't be recorded.

Disable profiling

Profiler.stopProfiling();

Profile block start/end

Profiler.profileBlockStart("block1");
// Work you want to profile
Profiler.profileBlockEnd();

Profile block

Profiler.profileBlock("block3", {
    // Work you want to profile
});

Profile function

@:build(hacksaw.profiler.Profiler.injectProfiler())
class Foo {
    @:profile
    public function bar() {
        // Work you want to profile
    }
}

Dumping profile to json file

Profiler.profileBlockStart("block2");
// Work you want profile
Profiler.profileBlockEnd();

Profiler.dumpToJsonFile("profile_dump.json");

Print generated json

Profiler.profileBlockStart("block2");
// Work you want profile
Profiler.profileBlockEnd();

trace(Profiler.dumpToJson());

You can then open up chrome://tracing or https://www.speedscope.app/ to view the profile and inspect it.

Testing

You can run the unit tests with haxe test.hxml

Required libs

thx.core
buddy(required for unit tests)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages