Files
cpp-project-template/examples/microprofile_demo.cc
tqcq a58517497b
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
feat add microprile examples
2025-08-25 12:01:16 +08:00

32 lines
654 B
C++

#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;
}