摘要: 编程之美的第一个问题,我的机器是双核的,用文中的代码,得到的曲线波动比较大额,受其他进程的影响比较大。文中提到10ms接近windows的调度时间片,如果选得太小,会造成线程被频繁唤醒和挂起,造成内核不稳定。#include "windows.h"#include "stdlib.h"#include "math.h"// 时间片的尺度大概是 10 msvoid control_cpu_percentage(int per) { DWORD sleep_time = 30; //ms DWORD busy_time = per * s 阅读全文
posted @ 2013-09-06 21:23 litstrong 阅读(170) 评论(0) 推荐(0)