如何在 C# 应用程序中启用 MMCSS?
我想尝试多媒体类调度程序服务 http:/ /msdn.microsoft.com/en-us/library/ms684247(v=VS.85).aspx
我希望它可以通过更好地调度我的线程来减少延迟。
如何在 C# 中完成?
注意:我的应用程序与多媒体无关,我只需要 MMCSS 的功能。
I want to try Multimedia Class Scheduler Service http://msdn.microsoft.com/en-us/library/ms684247(v=VS.85).aspx
I hope it can reduce latency by scheduling my threads better.
How can it be done in C# ?
Note: my app is nothing to do with multimedia I just need features of MMCSS.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来您所需要的只是 P/Invoke 这些 API 调用中的一个或另一个。
然而,我怀疑当垃圾收集器介入并将事情搞砸时,所有这些都将是徒劳的。
您是否对应用程序进行过分析以了解其幕后情况?如果您的应用程序确实对延迟敏感,那么说实话,C# 可能是错误的语言选择。
It would seem all you need is to P/Invoke one or other of those API calls.
However, I suspect all that will be in vain when the garbage collector steps in and messes things up.
Have you done any profiling of the app to see what's going on under the covers? If you app is truly that latency sensitive then C# is probably the wrong choice of language to be honest.
我不确定在托管应用程序中使用 MMCSS 有何意义。毕竟,MMCSS 的重点是调整进程的调度优先级,以避免多媒体流处理期间出现停顿 - 我们谈论的是纳秒级调度。但是,对于托管语言,垃圾收集可能随时发生,并且可能需要数十甚至数百毫秒,那么我不确定 MMCSS 会提供什么好处垃圾收集不会完全消除它。
考虑到这一点,我预计不会很快看到 MMCSS 的托管接口。您当然可以通过 P/Invoke 访问它,但我不希望它出现奇迹:)
I'm not sure what the point of using the MMCSS would be in a managed application. After all, the point of the MMCSS is to adjust the scheduling priority of the process to avoid stalls during multimedia stream processing - we're talking nanosecond level scheduling. But with a managed language where a garbage collection can happen at any time and potentially take tens or even hundreds of milliseconds, then I'm not sure what benefit the MMCSS would provide that wouldn't be totally wiped out by garbage collection.
With that in mind, I wouldn't expect to see a managed interface to the MMCSS any time soon. You can certainly access it via P/Invoke, but I wouldn't expect miracles from it :)