惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

S
Secure Thoughts
Security Latest
Security Latest
Simon Willison's Weblog
Simon Willison's Weblog
O
OpenAI News
GbyAI
GbyAI
L
LINUX DO - 最新话题
A
Arctic Wolf
T
Tor Project blog
G
GRAHAM CLULEY
I
InfoQ
博客园_首页
IT之家
IT之家
The Register - Security
The Register - Security
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
Blog — PlanetScale
Blog — PlanetScale
N
Netflix TechBlog - Medium
K
Kaspersky official blog
博客园 - 三生石上(FineUI控件)
S
SegmentFault 最新的问题
U
Unit 42
PCI Perspectives
PCI Perspectives
量子位
P
Palo Alto Networks Blog
S
Securelist
T
Troy Hunt's Blog
博客园 - 【当耐特】
Recorded Future
Recorded Future
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
S
Security Affairs
Engineering at Meta
Engineering at Meta
T
The Blog of Author Tim Ferriss
博客园 - 聂微东
罗磊的独立博客
N
News and Events Feed by Topic
人人都是产品经理
人人都是产品经理
B
Blog RSS Feed
NISL@THU
NISL@THU
C
Cisco Blogs
T
Threatpost
有赞技术团队
有赞技术团队
Forbes - Security
Forbes - Security
Hugging Face - Blog
Hugging Face - Blog
Last Week in AI
Last Week in AI
T
The Exploit Database - CXSecurity.com
Cloudbric
Cloudbric
Cyberwarzone
Cyberwarzone
Google DeepMind News
Google DeepMind News
C
Cyber Attacks, Cyber Crime and Cyber Security

博客园 - John Rambo

定时关机脚本 Mean shift算法处理图像(Scilab & C#) Arimoto–Blahut algorithm (Mathematica) 1分钟搞定QuickSort算法 C#行列式计算程序 MIDL语法详解 (译) Virtual PC2007 + Redhat9下的网络配置 关于IFromatterProvider Total KMP 分析函数调用的汇编指令 why c++/cli About double-checked locking 对透明代理源码的一些理解 ReaderWriterLockSlim CallContext类 GDI+ is F**king unbelievable 第一个Postsharp插件 WeakReference System. ThreadStaticAttribute
A better timer
John Rambo · 2008-11-16 · via 博客园 - John Rambo

Windows forms中自带的Timer控件据说精度只有55ms。又有传说在Winnt 4.0以上精度可以达到10ms。

不知道为什么已经没有心情再去考证到底是怎么回事,决定自己写一个:

Code

效果:

可以看到刷新率可以达到90桢每秒。

不过我遇到了一个很奇怪的问题,关于Thread.Sleep。当指定的间隔小于10000tick的时候,cpu占用就接近100%,但是只要达到了10000tick,cpu占用立刻就变成0%。不知道是为什么。可能是因为当小于10000tick的时候是用自旋锁实现,大于等于10000tick的时候是用另外的方式实现的。

另外一个十分棘手的问题是屏幕闪烁。在Form上指定的ControlStyle后,仍然有一定的闪烁,难道GDI+的性能就这么成问题?

完整的代码:/Files/zhy2002/GDIPlusMovable.rar