I have a question about using Python on Linux.

Asked 2 years ago, Updated 2 years ago, 47 views

I check the L2 cache miss rate using perf, but if it goes over 50 percent, I want to light the LED on the raspberry pie. You want to write this in Python.

When you turn it off, Linux in Raspberry can take Python and use GPIO to turn it on, but I wonder if you can detect L2 cache miss rate in the code. If so, how should the code be written?

If not, is there any other way?

Thank you.

linux python3 raspberry-pi

2022-09-21 23:05

1 Answers

import commands
output = commands.getstatusoutput('ls -l')
print(output)

If you do the above on Python, you can get the result of running ls -l. How about parsing output by putting the perf command instead of ls?


2022-09-21 23:05

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.