例程讲解-02-cpufreq_scaling CPU频率缩放
import sensor, image, time, cpufreq
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
def test_image_processing():
for i in range(0, 50):
clock.tick()
img = sensor.snapshot()
img.find_edges(image.EDGE_CANNY, threshold=(50, 80))
print("\nFrequency Scaling Test...")
for f in cpufreq.get_supported_frequencies():
cpufreq.set_frequency(f)
clock.reset()
test_image_processing()
freqs = cpufreq.get_current_frequencies()
print("CPU Freq:%dMHz HCLK:%dMhz PCLK1:%dMhz PCLK2:%dMhz FPS:%.2f" %(freqs[0], freqs[1], freqs[2], freqs[3], clock.fps()))