Skip to content

Commit

Permalink
Get parallelism to kind of work
Browse files Browse the repository at this point in the history
  • Loading branch information
quantumish committed Feb 3, 2024
1 parent d06e943 commit e936e00
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.PHONY: test_baseline_stats profile test_read_rapl

test_read_rapl:
g++ src/rapl.cpp tests/test_read_rapl.c -I./src -o test_read_rapl

Expand Down
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ std::vector<pid_t> get_tids(pid_t target) {
struct dirent *ep;
std::vector<pid_t> tids;
DIR* dp = opendir(path);
if (dp == NULL) {
tids.push_back(target);
return tids;
}
while ((ep = readdir(dp))) {
tids.push_back(strtoll(ep->d_name, NULL, 10));
}
Expand Down
13 changes: 7 additions & 6 deletions src/profiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,13 @@ std::vector<std::string> unwind(pid_t pid) {
unw_word_t offset;
char fname[MAX_SYMLEN] = {0};
int resp = unw_get_proc_name(&c, fname, MAX_SYMLEN, &offset);
unw_word_t ip;
unw_get_reg(&c, UNW_REG_IP, &ip);
Dl_info info;
dladdr((void*)ip, &info);
printf("%p\n", (void*)ip);
printf("%s: %p\n",fname, (char*)info.dli_fbase);
// unw_word_t ip;
// unw_get_reg(&c, UNW_REG_IP, &ip);
// Dl_info info;
// dladdr((void*)ip, &info);
// printf("%p\n", (void*)ip);
// printf("%s: %p\n",fname, (char*)info.dli_fbase);

// disas(pid, regs.rip);
// printf("RIP: %llx instruction %lx\n", regs.rip, ins);
stack.emplace_back(fname);
Expand Down
2 changes: 1 addition & 1 deletion src/rapl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#include <windows.h>
#define SLEEP(s) sleep(s)
#else
#include <unistd.h>
#include <time.h>
#define SLEEP(s) nanosleep((const struct timespec[]){{0, s * 1000000}}, NULL)
#endif

Expand Down

0 comments on commit e936e00

Please sign in to comment.