mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-14 12:04:35 +00:00
31 lines
570 B
C++
31 lines
570 B
C++
|
// g++ fibers.cpp ../TracyClient.cpp -DTRACY_ENABLE -DTRACY_FIBERS -lpthread -ldl
|
||
|
|
||
|
#include <thread>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
#include "../Tracy.hpp"
|
||
|
#include "../TracyC.h"
|
||
|
|
||
|
const char* fiber = "job1";
|
||
|
TracyCZoneCtx zone;
|
||
|
|
||
|
int main()
|
||
|
{
|
||
|
std::thread t1( [] {
|
||
|
TracyFiberEnter( fiber );
|
||
|
TracyCZone( ctx, 1 );
|
||
|
zone = ctx;
|
||
|
sleep( 1 );
|
||
|
TracyFiberLeave;
|
||
|
});
|
||
|
t1.join();
|
||
|
|
||
|
std::thread t2( [] {
|
||
|
TracyFiberEnter( fiber );
|
||
|
sleep( 1 );
|
||
|
TracyCZoneEnd( zone );
|
||
|
TracyFiberLeave;
|
||
|
});
|
||
|
t2.join();
|
||
|
}
|