File: Timing.htm

package info (click to toggle)
tbb 4.2~20140122-5
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 21,492 kB
  • ctags: 21,278
  • sloc: cpp: 92,813; ansic: 9,775; asm: 1,070; makefile: 1,057; sh: 351; java: 226; objc: 98; pascal: 71; xml: 41
file content (46 lines) | stat: -rwxr-xr-x 3,353 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html
  PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- saved from url=(0014)about:internet -->
<html xmlns:MSHelp="http://www.microsoft.com/MSHelp/" lang="en-us" xml:lang="en-us"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="DC.Type" content="topic">
<meta name="DC.Title" content="Timing">
<meta name="DC.subject" content="Timing">
<meta name="keywords" content="Timing">
<meta name="DC.Relation" scheme="URI" content="../tbb_userguide/title.htm">
<meta name="DC.Format" content="XHTML">
<meta name="DC.Identifier" content="tutorial_Timing">
<link rel="stylesheet" type="text/css" href="../intel_css_styles.css">
<title>Timing</title>
<xml>
<MSHelp:Attr Name="DocSet" Value="Intel"></MSHelp:Attr>
<MSHelp:Attr Name="Locale" Value="kbEnglish"></MSHelp:Attr>
<MSHelp:Attr Name="TopicType" Value="kbReference"></MSHelp:Attr>
</xml>
</head>
<body id="tutorial_Timing">
 <!-- ==============(Start:NavScript)================= -->
 <script src="..\NavScript.js" language="JavaScript1.2" type="text/javascript"></script>
 <script language="JavaScript1.2" type="text/javascript">WriteNavLink(1);</script>
 <!-- ==============(End:NavScript)================= -->
<a name="tutorial_Timing"><!-- --></a>


<h1 class="topictitle1">Timing</h1>

<div><p>When measuring the performance of parallel programs, it is usually <em>wall clock</em> time, not CPU time, that matters. The reason is that better parallelization typically increases aggregate CPU time by employing more CPUs. The goal of parallelizing a program is usually to make it run <em>faster</em> in real time.</p>
<p>The class <samp class="codeph">tick_count</samp> in Intel&reg; Threading Building Blocks (Intel&reg; TBB) provides a simple interface for measuring wall clock time. A <samp class="codeph">tick_count</samp> value obtained from the static method <span class="option">tick_count::now()</span> represents the current absolute time. Subtracting two <samp class="codeph">tick_count</samp> values yields a relative time in <samp class="codeph">tick_count::interval_t</samp>, which you can convert to seconds, as in the following example:</p>
<pre>tick_count t0 = tick_count::now();
... do some work ...
tick_count t1 = tick_count::now();
printf("work took %g seconds\n",(t1-t0).seconds());</pre><p>Unlike some timing interfaces, <samp class="codeph">tick_count</samp> is guaranteed to be safe to use across threads. It is valid to subtract <samp class="codeph">tick_count</samp> values that were created by different threads. A <samp class="codeph">tick_count</samp> difference can be converted to seconds.</p>
<p>The resolution of <samp class="codeph">tick_count</samp> corresponds to the highest resolution timing service on the platform that is valid across threads in the same process. Since the CPU timer registers are <em>not</em> valid across threads on some platforms, this means that the resolution of <span class="option">tick_count</span> can not be guaranteed to be consistent across platforms.</p>
</div>

<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong>&nbsp;<a href="../tbb_userguide/title.htm">Intel&reg; Threading Building Blocks (Intel&reg; TBB) User Guide</a></div>
</div>
<div></div>

</body>
</html>