mirror of
https://github.com/mmueller41/mxtasking.git
synced 2026-01-21 12:42:57 +01:00
free and printFloatUS
changed destructor to function removed creation of char array
This commit is contained in:
@@ -44,7 +44,6 @@ public:
|
|||||||
|
|
||||||
std::string printFloatUS(std::uint64_t ns)
|
std::string printFloatUS(std::uint64_t ns)
|
||||||
{
|
{
|
||||||
char* str = new char[100];
|
|
||||||
std::uint64_t remainder = ns % 1000;
|
std::uint64_t remainder = ns % 1000;
|
||||||
std::uint64_t front = ns / 1000;
|
std::uint64_t front = ns / 1000;
|
||||||
char strRemainder[4];
|
char strRemainder[4];
|
||||||
@@ -56,9 +55,7 @@ std::string printFloatUS(std::uint64_t ns)
|
|||||||
}
|
}
|
||||||
strRemainder[3] = '\0';
|
strRemainder[3] = '\0';
|
||||||
|
|
||||||
sprintf(str, "%lu.%s", front, strRemainder);
|
std::string message = std::to_string(front) + "." + strRemainder;
|
||||||
|
|
||||||
std::string message(str);
|
|
||||||
return message;
|
return message;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -350,15 +347,16 @@ void TaskingProfiler::saveProfile()
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Destructor
|
//Destructor
|
||||||
TaskingProfiler::~TaskingProfiler()
|
void TaskingProfiler::free()
|
||||||
{
|
{
|
||||||
|
std::uint16_t total_cores = TaskingProfiler::getInstance().getTotalCores();
|
||||||
for(std::uint16_t cpu_id = 0; cpu_id < total_cores; cpu_id++)
|
for(std::uint16_t cpu_id = 0; cpu_id < total_cores; cpu_id++)
|
||||||
{
|
{
|
||||||
delete[] task_data[cpu_id];
|
delete[] task_data[cpu_id];
|
||||||
}
|
}
|
||||||
delete[] task_data;
|
delete[] task_data;
|
||||||
delete[] task_id_counter;
|
delete[] TaskingProfiler::getInstance().getTaskIdCounter();
|
||||||
delete[] queue_id_counter;
|
delete[] TaskingProfiler::getInstance().getQueueIdCounter();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,9 +28,6 @@ public:
|
|||||||
std::chrono::high_resolution_clock::time_point timestamp;
|
std::chrono::high_resolution_clock::time_point timestamp;
|
||||||
};
|
};
|
||||||
|
|
||||||
//Destructor
|
|
||||||
~TaskingProfiler();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TaskingProfiler() {};
|
TaskingProfiler() {};
|
||||||
std::chrono::time_point<std::chrono::high_resolution_clock> relTime;
|
std::chrono::time_point<std::chrono::high_resolution_clock> relTime;
|
||||||
@@ -97,7 +94,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void printTP(std::uint64_t start, std::uint64_t end);
|
void printTP(std::uint64_t start, std::uint64_t end);
|
||||||
|
|
||||||
|
void free();
|
||||||
|
|
||||||
task_info** getTaskData() { return task_data; }
|
task_info** getTaskData() { return task_data; }
|
||||||
queue_info** getQueueData() { return queue_data; }
|
queue_info** getQueueData() { return queue_data; }
|
||||||
|
std::uint64_t* getTaskIdCounter() { return task_id_counter; }
|
||||||
|
std::uint64_t* getQueueIdCounter() { return queue_id_counter; }
|
||||||
|
std::uint16_t getTotalCores() { return total_cores; }
|
||||||
|
|
||||||
std::chrono::time_point<std::chrono::high_resolution_clock> getTinit() { return tinit; }
|
std::chrono::time_point<std::chrono::high_resolution_clock> getTinit() { return tinit; }
|
||||||
};
|
};
|
||||||
@@ -276,7 +276,7 @@ public:
|
|||||||
~runtime_guard() noexcept { runtime::start_and_wait();
|
~runtime_guard() noexcept { runtime::start_and_wait();
|
||||||
if constexpr (config::use_tasking_profiler())
|
if constexpr (config::use_tasking_profiler())
|
||||||
{
|
{
|
||||||
TaskingProfiler::getInstance().~TaskingProfiler();
|
TaskingProfiler::getInstance().free();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user