locked
use performance.mark in code, but user marks not appear in the diagnostics session timeline of the profile. why?

    Question

  • I use performance.mark in code and run the UI Responsiveness Profile, but  user marks not appear in the diagnostics session timeline. Why?

    if (performance && performance.mark) {
            performance.mark("getting data");
    }

    Wednesday, November 27, 2013 9:54 AM

Answers

  • I'm not sure. I assume (a) you're working in Windows 8.1 with an 8.1 targeted app, and (b) you're using the HTML UI Responsiveness tool via VS's Debug > Performance and Diagnostics hub. I have an app that uses performance.mark under these conditions and I see the marks just fine:

    If you're targeting Windows 8, you'll need to use msWriteProfilerMark instead. Have you also confirmed that your performance.mark calls are being called? If you're targeting Win8 then performance.mark could be undefined in which case your calls never get made.

    That's all I can think of.

    Kraig

    Author, Programming Windows Store Apps with HTML, CSS, and JavaScript, Second Edition, a free ebook from Microsoft Press. First edition (for Windows 8) also available.


    • Marked as answer by cindytwu Monday, December 09, 2013 8:01 AM
    Thursday, November 28, 2013 12:25 AM
  • I forgot an important detail (sorry about that)--the string you pass to msWriteProfilerMark has to start with "VisualProfioler:mark,". It's odd, but required. So in your case, do this:

    msWriteProfilerMark("VisualProfiler:mark,getting data");

    You probably want to write a simple method to do this automatically:

    function profileMark (s) {
        msWriteProfilerMark("VisualProfiler:mark," + s);
    }

    Then when you target Windows 8.1 you can just change the one line to use performance.mark instead.
    • Marked as answer by cindytwu Monday, December 09, 2013 8:00 AM
    Tuesday, December 03, 2013 8:22 PM

All replies

  • I'm not sure. I assume (a) you're working in Windows 8.1 with an 8.1 targeted app, and (b) you're using the HTML UI Responsiveness tool via VS's Debug > Performance and Diagnostics hub. I have an app that uses performance.mark under these conditions and I see the marks just fine:

    If you're targeting Windows 8, you'll need to use msWriteProfilerMark instead. Have you also confirmed that your performance.mark calls are being called? If you're targeting Win8 then performance.mark could be undefined in which case your calls never get made.

    That's all I can think of.

    Kraig

    Author, Programming Windows Store Apps with HTML, CSS, and JavaScript, Second Edition, a free ebook from Microsoft Press. First edition (for Windows 8) also available.


    • Marked as answer by cindytwu Monday, December 09, 2013 8:01 AM
    Thursday, November 28, 2013 12:25 AM
  • Thanks for your answer. I am working in Windows 8 with an 8 targeted app. As you said, I use msWriteProfilerMark  instead of performance.mark, but user marks still not appear in the diagnostics session timeline. 

    WinJS.UI.Pages.define("/html/test.html", {
            ready: function (element, options) {
    msWriteProfilerMark("getting data");

    ...

    Thursday, November 28, 2013 1:04 PM
  • I forgot an important detail (sorry about that)--the string you pass to msWriteProfilerMark has to start with "VisualProfioler:mark,". It's odd, but required. So in your case, do this:

    msWriteProfilerMark("VisualProfiler:mark,getting data");

    You probably want to write a simple method to do this automatically:

    function profileMark (s) {
        msWriteProfilerMark("VisualProfiler:mark," + s);
    }

    Then when you target Windows 8.1 you can just change the one line to use performance.mark instead.
    • Marked as answer by cindytwu Monday, December 09, 2013 8:00 AM
    Tuesday, December 03, 2013 8:22 PM