mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-26 07:54:36 +00:00
Trace-specific save path retrieval.
This commit is contained in:
parent
3ec1771f5a
commit
34cc7183d0
@ -1,4 +1,5 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <inttypes.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@ -109,4 +110,32 @@ const char* GetSavePath( const char* file )
|
|||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* GetSavePath( const char* program, uint64_t time, const char* file, bool create )
|
||||||
|
{
|
||||||
|
enum { Pool = 8 };
|
||||||
|
enum { MaxPath = 512 };
|
||||||
|
static char bufpool[Pool][MaxPath];
|
||||||
|
static int bufsel = 0;
|
||||||
|
char* buf = bufpool[bufsel];
|
||||||
|
bufsel = ( bufsel + 1 ) % Pool;
|
||||||
|
|
||||||
|
size_t sz;
|
||||||
|
GetConfigDirectory( buf, sz );
|
||||||
|
|
||||||
|
// 604800 = 7 days
|
||||||
|
sz += sprintf( buf+sz, "/tracy/user/%c/%s/%" PRIu64 "/%" PRIu64 "/", program[0], program, uint64_t( time / 604800 ), time );
|
||||||
|
|
||||||
|
if( create )
|
||||||
|
{
|
||||||
|
auto status = CreateDirStruct( buf );
|
||||||
|
assert( status );
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto fsz = strlen( file );
|
||||||
|
assert( sz + fsz < MaxPath );
|
||||||
|
memcpy( buf+sz, file, fsz+1 );
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,13 @@
|
|||||||
#ifndef __TRACYSTORAGE_HPP__
|
#ifndef __TRACYSTORAGE_HPP__
|
||||||
#define __TRACYSTORAGE_HPP__
|
#define __TRACYSTORAGE_HPP__
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
|
|
||||||
const char* GetSavePath( const char* file );
|
const char* GetSavePath( const char* file );
|
||||||
|
const char* GetSavePath( const char* program, uint64_t time, const char* file, bool create );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user