Fix random bugs discovered while reading the code

In HsaTimer::correlated_pair_ns, the time ID should be used to
select the clock ID passed to clock_gettime.

In MemoryPool::allocator_default, pass the correct value to realloc.

Change-Id: I5d10c0994c07fdeadd99c81deba4e71a4f579523
This commit is contained in:
Laurent Morichetti
2021-04-15 23:08:00 -07:00
committed by Laurent Morichetti
parent 8fb3cdb30b
commit 297b613604
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -52,7 +52,7 @@ class MemoryPool {
if (*ptr == NULL) {
*ptr = reinterpret_cast<char*>(malloc(size));
} else if (size != 0) {
*ptr = reinterpret_cast<char*>(realloc(ptr, size));
*ptr = reinterpret_cast<char*>(realloc(*ptr, size));
} else {
free(*ptr);
*ptr = NULL;
+1 -1
View File
@@ -223,7 +223,7 @@ class HsaTimer {
void correlated_pair_ns(time_id_t time_id, uint32_t iters,
timestamp_t* timestamp_v, timestamp_t* time_v, timestamp_t* error_v) const {
clockid_t clock_id = 0;
switch (clock_id) {
switch (time_id) {
case TIME_ID_CLOCK_REALTIME:
clock_id = CLOCK_REALTIME;
break;