py rapl
1.0.0
py-rapl
هي مكتبة بسيطة جدًا تدعم أخذ عينات من RAPL، أو عدادات الطاقة المتوسطة التي يتم تشغيلها بواسطة معظم وحدات المعالجة المركزية Intel الحديثة، إن لم يكن جميعها.
import rapl
s1 = rapl.RAPLMonitor.sample()
# Some work that you want to measure.
s2 = rapl.RAPLMonitor.sample()
# Take the difference of the samples
diff = s2 - s1
# Print the difference in microjoules
print(diff.energy("package-0", "core", rapl.UJOULES))
# Print the average power
print(diff.average_power("package-0", "core"))