Breakend / experiment-impact-tracker

MIT License
273 stars 31 forks source link

benchmark non-python programs #35

Open Pzoom522 opened 3 years ago

Pzoom522 commented 3 years ago

Hi, thanks for this great project! I'm wondering whether it's possible to track the usage of non-python programs, e.g., C++ code? And how?

Pzoom522 commented 3 years ago

I've found out that this can be done by simply writing a wrapper using os.system(). Close for now.

cifkao commented 3 years ago

I would vote for reopening this issue because I'm sure there are other people wanting to do the same thing (like me). A command-line wrapper would indeed be very handy. @Pzoom522 maybe you can share your wrapper or contribute it to the repo?

Pzoom522 commented 3 years ago

I would vote for reopening this issue because I'm sure there are other people wanting to do the same thing (like me). A command-line wrapper would indeed be very handy. @Pzoom522 maybe you can share your wrapper or contribute it to the repo?

Surely I will. I will put my workaround here later this week.

Pzoom522 commented 3 years ago

@cifkao Basically, I found that this tool is tracking the usage of everything the main program initialises until the main program terminates. Therefore, I chose to directly start a non-python process using os.system(), as it will wait for the returned value of the command. I benchmarked some computationally expensive C programs with the following simple wrapper and got reasonable results.

import os
from experiment_impact_tracker.compute_tracker import ImpactTracker
tracker = ImpactTracker(<your log directory here>)
tracker.launch_impact_monitor()
os.system(<your command here>)

Dear maintainers, please let me know if this workaround is correct, so I can make a pull request.