Skip to content

Commit

Permalink
Review comments addressed
Browse files Browse the repository at this point in the history
  • Loading branch information
HaseenaSainul committed Oct 4, 2024
1 parent 7078d1c commit 4ac76be
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 24 deletions.
22 changes: 2 additions & 20 deletions Source/Thunder/PluginHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,25 +298,6 @@ POP_WARNING()
return deviceId;
}

template <typename TYPE>
inline typename std::enable_if<(std::is_same<TYPE, void*>::value), void>::type
PrintMetaData(const uint8_t index, const TYPE& workerId, const uint32_t runs)
{
printf(" Thread%02d|0x%16" PRIxPTR ": %10d", (index), reinterpret_cast<uintptr_t>(workerId), runs);
}

template <typename TYPE>
inline typename std::enable_if<(!std::is_same<TYPE, void*>::value), void>::type
PrintMetaData(const uint8_t index, const TYPE workerId, const uint32_t runs)
{
#ifdef __WINDOWS__
printf(" Thread%02d|0x%16lX: %10d", (index), workerId, runs);
#else
printf(" Thread%02d|0x%16" PRIu64 ": %10d", (index), static_cast<uint64_t>(workerId), runs);
#endif
}


extern "C" {

#ifndef __WINDOWS__
Expand Down Expand Up @@ -908,7 +889,8 @@ POP_WARNING()
printf("Pending: %d\n", static_cast<uint32_t>(metaData.Pending.size()));
printf("Poolruns:\n");
for (uint8_t index = 0; index < metaData.Slots; index++) {
PrintMetaData(index, metaData.Slot[index].WorkerId, metaData.Slot[index].Runs);
printf(" Thread%02d|0x%16" PRIu64 ": %10d", (index), static_cast<uint64_t>(Metadata::InstanceId(metaData.Slot[index].WorkerId)), metaData.Slot[index].Runs);

if (metaData.Slot[index].Job.IsSet() == false) {
printf("\n");
}
Expand Down
2 changes: 1 addition & 1 deletion Source/Thunder/PostMortem.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ namespace PluginHost {
Add(_T("module"), &Module);
Add(_T("line"), &Line);

Address = PluginHost::Metadata::InstanceId(source.address);
Address = reinterpret_cast<Core::instance_id>(source.address);
Function = source.function;
if (source.module.empty() == false) {
Module = source.module;
Expand Down
4 changes: 2 additions & 2 deletions Source/plugins/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ namespace PluginHost {
return static_cast<Core::instance_id>(id);
}

template <typename TYPE>
template <typename TYPE = Core::thread_id>
static typename std::enable_if<(std::is_same<TYPE, void*>::value), Core::thread_id>::type
ThreadId(Core::instance_id id)
{
return reinterpret_cast<TYPE>(id);
}
template <typename TYPE>
template <typename TYPE = Core::thread_id>
static typename std::enable_if<!(std::is_same<TYPE, void*>::value), Core::thread_id>::type
ThreadId(Core::instance_id id)
{
Expand Down
2 changes: 1 addition & 1 deletion Tests/unit/core/test_workerpool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ namespace Core {
sprintf(id, "%x", static_cast<::Thunder::Core::thread_id>(pthread_self()));
for (uint8_t index = 0; index < _threadsCount + 2; index++) {
char workerId[MaxSize];
sprintf(workerId, "%x", static_cast<::thread_id>(::Thunder::Core::IWorkerPool::Instance().Id(index)));
sprintf(workerId, "%x", static_cast<::Thunder::Core::thread_id>(::Thunder::Core::IWorkerPool::Instance().Id(index)));

if (strcpy(workerId, id)) {
isPoolId = true;
Expand Down

0 comments on commit 4ac76be

Please sign in to comment.