diff --git a/src/block.cpp b/src/block.cpp index e1114c6..7a4d2ae 100644 --- a/src/block.cpp +++ b/src/block.cpp @@ -21,6 +21,10 @@ Block::Block(const char* _name, color_t _color, block_type_t _type) : name(_name) { tick(begin); + if (this->type == BLOCK_TYPE_MARK) + { + end = begin; + } thread_id = std::hash()(std::this_thread::get_id()); } @@ -42,8 +46,4 @@ Block::~Block() endBlock(); } - else{//for mark end equal begin - end = begin; - } - } diff --git a/src/profile_manager.cpp b/src/profile_manager.cpp index 22031ef..611b968 100644 --- a/src/profile_manager.cpp +++ b/src/profile_manager.cpp @@ -2,6 +2,7 @@ #include #include + #include using namespace profiler; @@ -77,7 +78,12 @@ ProfileManager::ProfileManager() ProfileManager::~ProfileManager() { + std::ofstream of("test.prof",std::fstream::binary); + for (auto* b : m_blocks){ + uint16_t sz = b->size(); + of.write((const char*)&sz, sizeof(uint16_t)); + of.write(b->data(), b->size()); delete b; } }