feat add microprile examples
Some checks failed
sm-rpc / build (Release, host.gcc) (push) Failing after 11m15s
sm-rpc / build (Release, arm-linux-gnueabihf) (push) Failing after 11m28s
sm-rpc / build (Release, aarch64-linux-gnu) (push) Failing after 11m50s
sm-rpc / build (Debug, mipsel-linux-gnu) (push) Failing after 12m3s
sm-rpc / build (Debug, host.gcc) (push) Failing after 12m13s
sm-rpc / build (Debug, arm-linux-gnueabihf) (push) Failing after 12m30s
sm-rpc / build (Debug, aarch64-linux-gnu) (push) Failing after 12m42s
sm-rpc / build (Release, mipsel-linux-gnu) (push) Failing after 14m53s

This commit is contained in:
tqcq
2025-08-25 12:01:16 +08:00
parent c8b9782baa
commit a58517497b
4 changed files with 42 additions and 76 deletions

View File

@@ -0,0 +1,31 @@
#include <microprofile.h>
#include <stdio.h>
#include <chrono>
#include <thread>
MICROPROFILE_DEFINE(MAIN, "MAIN", "Main", MP_AUTO);
void Test()
{
MICROPROFILE_TIMELINE_SCOPE(MP_AUTO, "one");
}
int main()
{
MicroProfileOnThreadCreate("Main");
MicroProfileSetEnableAllGroups(true);
MicroProfileSetForceMetaCounters(true);
printf("port: %d\n", MicroProfileWebServerPort());
MicroProfileStartAutoFlip(30);
while (true)
{
MICROPROFILE_SCOPE(MAIN);
Test();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
MicroProfileStopAutoFlip();
MicroProfileShutdown();
return 0;
}