测量 Silverlight / Moonlight 应用程序的性能

发布于 2024-11-05 04:08:16 字数 613 浏览 5 评论 0原文

我对 Silverlight 的高水平性能测量感兴趣,尤其是与 Moonlight 相比。我浏览了一下并想出了一些工具(SilverliightSpy等),但必须有其他工具或方法来做到这一点。

我想调查的高级问题是

  • Moonlight 和 silverlight 如何比较 wrt 性能
  • 我应该如何设计我的应用程序以获得最佳性能(在 SL、ML 或两者上)

我感兴趣的性能特征是

  • 我的测试如何应用程序利用 CPU(粗略比较) - 即它是否将工作负载转移到 GPU
  • 渲染时间。不仅是 FPS,还有延迟 - “如果我修改某些视觉元素的属性......”
    • “...多久之后它们会在屏幕上更新”
    • “...这段时间内 CPU 利用率是多少”

有什么建议吗?如果能够在应用程序内执行此操作,那就太好了,这样我就可以在 Silverlight 上运行该应用程序,然后在 Moonlight 上运行该应用程序并比较其输出。不过,跨平台分析器也可以工作。

I'm interested in high level performance measurement of Silverlight especially in comparison to Moonlight. I've browsed around and came up with some tools (SilverliightSpy among others) but there has to be other tools or ways to do this.

The high level questions I'd like to investigate are

  • How does moonlight and silverlight compare wrt performance
  • How should I design my app to get best performance (on SL, ML or both)

The performance characteristics I'm interested in are

  • How does my test app utilize the CPU (rough comparison) - i.e. does it off load work to the GPU
  • Rendering time. Not only FPS but also latency - "if I modify some visual element's properties..."
    • "...how long before they get updated on the screen"
    • "...how much is the CPU utilized during that time"

Any suggestions? It would be nice to be able to do this in-app, so that I can just run the app on Silverlight and then on Moonlight and compare its output. A cross platform profiler would also work though.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

℉絮湮 2024-11-12 04:08:17

由于还没有人回答,我想我可以在提出问题后发布我自己的发现。我仍然不知道如何测量从修改视觉效果的外观到将其绘制在屏幕上所需的时间。

要计算应用程序内的 CPU 利用率,您可以使用 分析类。要计算帧速率,只需连接到静态 CompositionTarget 类的渲染事件

private DispatcherTimer fpsTimer = new DispatcherTimer();
private DateTime lastFpsUpdate;
private Analytics analyzer = new System.Windows.Analytics();
private int frameCount;

public MyClass()
{
    fpsTimer.Interval = TimeSpan.FromSeconds(1);
    fpsTimer.Tick += new EventHandler(fpsTimer_Tick);
    fpsTimer.Start();
    lastFpsUpdate = DateTime.Now;
    CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
}

// Called every second
void fpsTimer_Tick(object sender, EventArgs e)
{
    double framerate = 0;
    framerate = frameCount / (DateTime.Now - lastFpsUpdate).TotalSeconds;
    c_statusMessage.Text = String.Format("Framerate: {0:0} fps, CPU utilization: {1:0.0}%", framerate, analyzer.AverageProcessLoad);
    lastFpsUpdate = DateTime.Now;
    frameCount = 0;
}

// Called by the framework on every frame
void CompositionTarget_Rendering(object sender, EventArgs e)
{
    frameCount++;
}

Since nobody has answered yet I figured I could post my own findings since asking the question. I still haven't figured out how to measure how much time it took from modifying a visual's appearance until it has been drawn on screen.

To calculate CPU utilization inside your app you can use the Analytics class. To calculate the framerate, just hook in to the static rendering event of the CompositionTarget class.

private DispatcherTimer fpsTimer = new DispatcherTimer();
private DateTime lastFpsUpdate;
private Analytics analyzer = new System.Windows.Analytics();
private int frameCount;

public MyClass()
{
    fpsTimer.Interval = TimeSpan.FromSeconds(1);
    fpsTimer.Tick += new EventHandler(fpsTimer_Tick);
    fpsTimer.Start();
    lastFpsUpdate = DateTime.Now;
    CompositionTarget.Rendering += new EventHandler(CompositionTarget_Rendering);
}

// Called every second
void fpsTimer_Tick(object sender, EventArgs e)
{
    double framerate = 0;
    framerate = frameCount / (DateTime.Now - lastFpsUpdate).TotalSeconds;
    c_statusMessage.Text = String.Format("Framerate: {0:0} fps, CPU utilization: {1:0.0}%", framerate, analyzer.AverageProcessLoad);
    lastFpsUpdate = DateTime.Now;
    frameCount = 0;
}

// Called by the framework on every frame
void CompositionTarget_Rendering(object sender, EventArgs e)
{
    frameCount++;
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文