Skip to content

Commit

Permalink
added support for configuring what is output to a csv file. This save…
Browse files Browse the repository at this point in the history
…s memory, and lets you combine timer, group and counter values in the same file
  • Loading branch information
jonasmr committed Jan 11, 2024
1 parent e3cd281 commit be96a8d
Show file tree
Hide file tree
Showing 4 changed files with 327 additions and 42 deletions.
13 changes: 12 additions & 1 deletion demo/workbench/demo_workbench.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ void t3()

void MicroProfileInstrumentFunctionsCalled(void* pFunction, const char* pFunctionName);

#define DUMP_SPIKE_TEST 0
#define DUMP_SPIKE_TEST 1

MICROPROFILE_DECLARE_LOCAL_ATOMIC_COUNTER(ThreadsStarted);
MICROPROFILE_DEFINE_LOCAL_ATOMIC_COUNTER(ThreadSpinSleep, "/runtime/spin_sleep");
Expand All @@ -221,7 +221,9 @@ int main(int argc, char* argv[])
MicroProfileSetEnableAllGroups(true);
MicroProfileSetForceMetaCounters(true);

#if !DUMP_SPIKE_TEST
MicroProfileStartContextSwitchTrace();
#endif

MICROPROFILE_COUNTER_CONFIG("/runtime/localcounter", MICROPROFILE_COUNTER_FORMAT_BYTES, 10000, 0);

Expand Down Expand Up @@ -276,6 +278,15 @@ int main(int argc, char* argv[])
RegisterGroups();
#endif

MicroProfileCsvConfigBegin(2, 2, 3, MICROPROFILE_CSV_FLAG_FRAME_TIME);
MicroProfileCsvConfigAddCounter("/runtime/localcounter/");
MicroProfileCsvConfigAddCounter("/memory/main/");
MicroProfileCsvConfigAddCounter("memory/gpu/vertexbuffers", "vbs");

MicroProfileCsvConfigAddTimer("MAIN", "Main", "renamedMAIN");
MicroProfileCsvConfigAddGroup("MAIN");
MicroProfileCsvConfigEnd();

StartFakeWork();
while (!g_nQuit)
{
Expand Down
4 changes: 2 additions & 2 deletions demo/workbench/workbench.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
Expand Down
Loading

0 comments on commit be96a8d

Please sign in to comment.