tapis-project / camera-traps

BSD 3-Clause "New" or "Revised" License
5 stars 9 forks source link

add power measuring plugin #24

Closed YJHMITWEB closed 10 months ago

YJHMITWEB commented 10 months ago

Modifications are based on camera-traps/0.3.2.

Pre-built power measuring plugin has been available on murphiey/power_measure_plugin:1.0.0 . A debug example is provided, set TEST_FUNCTION=1 in camera-traps/releases/0.3.2/docker-compose.ymldocker-compose.yml to see the demo.

Usage example:

  1. In plugins you want to measure power, first import necessary libs and packages:
    from ctevents.ctevents import send_power_measure_fb_event
    import os
  2. When trying to measure power:
    my_pids = [os.getpid()] # any pids you want to measure
    monitor_type = [0]      # 0 for CPU & GPU, 1 for CPU, 2 for GPU  (TODO: 3 for DRAM)
    monitor_duration = 10   # seconds
    send_power_measure_fb_event(socket, my_pids, monitor_type, monitor_duration)
  3. By default, the log files will be saved under the same directory as docker-compose.yml, but you can change it with desired mount.