0
0
mirror of https://github.com/yse/easy_profiler.git synced 2024-12-27 08:41:02 +08:00

backward compatibility with old size of thread_id_t. For #41

This commit is contained in:
Sergey Yagovtsev 2017-06-05 12:57:03 +03:00
parent 08ae417931
commit ccd0626bf8
3 changed files with 7 additions and 3 deletions

View File

@ -445,7 +445,7 @@ namespace profiler {
const uint16_t DEFAULT_PORT = EASY_DEFAULT_PORT;
typedef uint64_t timestamp_t;
typedef size_t thread_id_t;
typedef uint64_t thread_id_t;
typedef uint32_t block_id_t;
enum BlockType : uint8_t

View File

@ -87,6 +87,7 @@ extern const uint32_t EASY_CURRENT_VERSION;
# define EASY_VERSION_INT(v_major, v_minor, v_patch) ((static_cast<uint32_t>(v_major) << 24) | (static_cast<uint32_t>(v_minor) << 16) | static_cast<uint32_t>(v_patch))
const uint32_t MIN_COMPATIBLE_VERSION = EASY_VERSION_INT(0, 1, 0); ///< minimal compatible version (.prof file format was not changed seriously since this version)
const uint32_t EASY_V_100 = EASY_VERSION_INT(1, 0, 0); ///< in v1.0.0 some additional data were added into .prof file
const uint32_t EASY_V_130 = EASY_VERSION_INT(1, 3, 0); ///< in v1.3.0 changed sizeof(thread_id_t) uint32_t -> uint64_t
# undef EASY_VERSION_INT
const uint64_t TIME_FACTOR = 1000000000ULL;
@ -557,7 +558,10 @@ extern "C" {
EASY_BLOCK("Read thread data", ::profiler::colors::DarkGreen);
::profiler::thread_id_t thread_id = 0;
inFile.read((char*)&thread_id, sizeof(decltype(thread_id)));
long thread_id_t_size = sizeof(decltype(thread_id));
if (version < EASY_V_130)
thread_id_t_size = sizeof(uint32_t);
inFile.read((char*)&thread_id, thread_id_t_size);
auto& root = threaded_trees[thread_id];

View File

@ -1 +1 @@
1.2.0
1.3.0