Skip to content

Commit

Permalink
Make the turtle happy
Browse files Browse the repository at this point in the history
  • Loading branch information
cvonelm committed Oct 30, 2023
1 parent 2a0eadd commit dcca361
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 25 deletions.
32 changes: 16 additions & 16 deletions src/monitor/nec_monitor_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,22 @@ namespace lo2s
namespace monitor
{

int NecMonitorMain::get_nec_device_id_for_thread(Thread thread)
{
// /sys/class/ve/ve0 is not device 0, because that would make too much sense
// So look the device id up here
int NecMonitorMain::get_nec_device_id_for_thread(Thread thread)
{
// /sys/class/ve/ve0 is not device 0, because that would make too much sense
// So look the device id up here

int real_device_id = -1;
for (int i = 0; i < nodeinfo_.total_node_count; i++)
{
if (!ve_check_pid(nodeinfo_.nodeid[i], thread.as_pid_t()))
{
real_device_id = nodeinfo_.nodeid[i];
break;
}
}
return real_device_id;
}
int real_device_id = -1;
for (int i = 0; i < nodeinfo_.total_node_count; i++)
{
if (!ve_check_pid(nodeinfo_.nodeid[i], thread.as_pid_t()))
{
real_device_id = nodeinfo_.nodeid[i];
break;
}
}
return real_device_id;
}
NecMonitorMain::NecMonitorMain(trace::Trace& trace, int device)
: ThreadedMonitor(trace, fmt::format("VE {}", device)), trace_(trace), device_(device),
stopped_(false)
Expand All @@ -64,7 +64,7 @@ void NecMonitorMain::run()
threads.emplace_back(Thread(pid));
}

//For some god-forsaken reason, the last read entry from task_id_all will always be invalid
// For some god-forsaken reason, the last read entry from task_id_all will always be invalid

threads.pop_back();

Expand Down
11 changes: 5 additions & 6 deletions src/monitor/nec_thread_monitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ extern "C"

#include <libved.h>


namespace lo2s
{
namespace monitor
Expand All @@ -54,11 +53,11 @@ void NecThreadMonitor::monitor()
static int reg[] = { IC };
uint64_t val;

ve_get_regvals(device_, nec_thread_.as_pid_t(), 1, reg, &val);
otf2::chrono::time_point tp = lo2s::time::now();
otf2_writer_.write_calling_context_sample(tp, cctx_manager_.sample_ref(val), 2,
trace_.interrupt_generator().ref());
std::this_thread::sleep_for(nec_readout_interval_);
ve_get_regvals(device_, nec_thread_.as_pid_t(), 1, reg, &val);
otf2::chrono::time_point tp = lo2s::time::now();
otf2_writer_.write_calling_context_sample(tp, cctx_manager_.sample_ref(val), 2,
trace_.interrupt_generator().ref());
std::this_thread::sleep_for(nec_readout_interval_);
}

void NecThreadMonitor::finalize_thread()
Expand Down
7 changes: 4 additions & 3 deletions src/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,9 +346,10 @@ std::vector<std::string> get_thread_cmdline(Thread thread)

std::string get_nec_thread_comm(Thread thread)
{
// For normal processes, /proc/{PID}/comm contains the name of the program running in that process
// For NEC processes, it instead contains the name of the program loader, ve_exec
// So instead, we have to extract the name of the actual NEC program we are executing from the commandline arguments to ve_exec
// For normal processes, /proc/{PID}/comm contains the name of the program running in that
// process For NEC processes, it instead contains the name of the program loader, ve_exec So
// instead, we have to extract the name of the actual NEC program we are executing from the
// commandline arguments to ve_exec
std::string thread_name = fmt::format("{}", thread);

auto args = get_thread_cmdline(thread);
Expand Down

0 comments on commit dcca361

Please sign in to comment.