markAndMeasure Method

New for Internet Explorer 9

[This documentation is preliminary and is subject to change.]

Sets a performance mark and defines a performance measure between the new performance mark and an existing performance mark.

Syntax

MSPerformance.markAndMeasure(sMarkName, sMeasureName, sStartMarkName)

Parameters

sMarkName Required. The desired name for the ending performance mark.
sMeasureName Required. The desired name for the performance measure.
sStartMarkName Required. The performance mark to use as the starting performance mark.

Return Value

No return value.

Remarks

When you specify the sStartMarkName parameter, either use a pre-defined performance mark or one previously set by using the mark method. For a list of pre-defined performance marks, see the MSPerformanceTiming object.

Use the measure method to define a performance measure between two existing performance marks.

Example

The following example shows how to define a performance mark and how to define a measure by using that mark.

<!DOCTYPE html>
<head>
  <meta http-equiv="x-ua-compatible" content="ie=9">
  <script type="text/javascript">

    function doLoop() {
      var maxIter = 500000;
      var fib = 0;
      var fibn_1 = 0;
      var fibn_2 = 1;

      for (var i = 0; i < maxIter; i++) {
        fib = (fib == 0) ? 0 : fib;
        fib = fibn_1 + fibn_2;
        fibn_2 = fibn_1;
        fibn_1 = fib;
      }
    }
  </script>
</head>
<body>

  <script type="text/javascript">
     var oPerformance = window.msPerformance;
     oPerformance.mark("MyLoopBegin");
     doLoop();
     oPerformance.markAndMeasure("MyLoopEnd", "MyLoopMeasure", "MyLoopBegin");
     iMyLoopMS = oPerformance.getMeasure("MyLoopMeasure");
     alert("The loop took " + iMyLoopMS.toString() + " ms to execute.");
  </script>

</body>
</html>

Standards Information

There is no public standard that applies to this method.

Applies To

MSPerformance