<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://snipersim.org//w/index.php?action=history&amp;feed=atom&amp;title=Multiple_regions_of_interest</id>
	<title>Multiple regions of interest - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://snipersim.org//w/index.php?action=history&amp;feed=atom&amp;title=Multiple_regions_of_interest"/>
	<link rel="alternate" type="text/html" href="http://snipersim.org//w/index.php?title=Multiple_regions_of_interest&amp;action=history"/>
	<updated>2026-06-19T03:39:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.1</generator>
	<entry>
		<id>http://snipersim.org//w/index.php?title=Multiple_regions_of_interest&amp;diff=586&amp;oldid=prev</id>
		<title>Wheirman: Created page with &quot;== Application source code changes ==  Include the header file which defines Sniper&#039;s magic instructions. Make sure to compile using -I $SNIPER_ROOT/include so sim_api.h can be f...&quot;</title>
		<link rel="alternate" type="text/html" href="http://snipersim.org//w/index.php?title=Multiple_regions_of_interest&amp;diff=586&amp;oldid=prev"/>
		<updated>2014-10-09T09:19:04Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;== Application source code changes ==  Include the header file which defines Sniper&amp;#039;s magic instructions. Make sure to compile using -I $SNIPER_ROOT/include so sim_api.h can be f...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;== Application source code changes ==&lt;br /&gt;
&lt;br /&gt;
Include the header file which defines Sniper&amp;#039;s magic instructions. Make sure to compile using -I $SNIPER_ROOT/include so sim_api.h can be found.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;#include &amp;lt;sim_api.h&amp;gt;&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Add Magic markers around regions of interest. Arguments to SimMarker(a, b) can be any two integers, but by convention, a=1 for start, a=2 for stop, while b is the region identifier.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
(setup code)&lt;br /&gt;
 &lt;br /&gt;
SimMarker(1, 1001);&lt;br /&gt;
(region 1001 code)&lt;br /&gt;
SimMarker(2, 1001);&lt;br /&gt;
 &lt;br /&gt;
(uninteresting code)&lt;br /&gt;
 &lt;br /&gt;
SimMarker(1, 2345);&lt;br /&gt;
(region 2345 code)&lt;br /&gt;
SimMarker(2, 2345);&lt;br /&gt;
 &lt;br /&gt;
(fini code)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or for an iteration-based benchmark:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
for(int iter = 0; iter &amp;lt; 10; ++iter)&lt;br /&gt;
{&lt;br /&gt;
    SimMarker(1, iter);&lt;br /&gt;
    (loop body)&lt;br /&gt;
    SimMarker(2, iter);&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Running a single selected region in Sniper ==&lt;br /&gt;
 &lt;br /&gt;
The roi-iter.py script can select the region of interest by watching for SimMarker calls, with optional cache warmup&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;run-sniper -c CONFIG --roi-script [--no-cache-warming] -s roi-iter:A:B:C -- benchmark args ...&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
With:&lt;br /&gt;
* A = region ID of when to start cache warmup&lt;br /&gt;
* B = region ID of first region to run in detailed mode&lt;br /&gt;
* C = region ID of last region to run in detailed mode&lt;br /&gt;
* --no-cache-warming is used to disable cache warmup in code before region A&lt;br /&gt;
&lt;br /&gt;
=== Examples: ===&lt;br /&gt;
&lt;br /&gt;
Run a single region with ID 42 in detailed mode, with all code before it in cache-only:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;run-sniper -c CONFIG --roi-script -s roi-iter::42:42&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run benchmark iterations 100..110 in cache-only, 111-115 in detailed mode, fast-forward up to region 100 and after region 115:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;run-sniper -c CONFIG --roi-script --no-cache-warming -s roi-iter:100:111:115&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Selecting regions after simulating everything ==&lt;br /&gt;
&lt;br /&gt;
Simulate the complete application (or everything inside the usual SimRoiBegin/SimRoiEnd markers), and store statistics snapshots whenever encountering a SimMarker;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;run-sniper -c CONFIG [--roi] -s markers:stats&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Select the region between two markers for processing using --partial=region-begin:region-end&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# List all available markers&lt;br /&gt;
$ ./tools/dumpstats.py -l&lt;br /&gt;
start, roi-begin, marker-1-1001, marker-2-1001, marker-1-2345, marker-2-2345, roi-end, stop&lt;br /&gt;
$ tools/cpistack.py --partial=marker-1-1001:marker-2-1001&lt;br /&gt;
(CPI stack for region 1001)&lt;br /&gt;
$ tools/gen_simout.py --partial=marker-1-2345:marker-2-2345&lt;br /&gt;
(sim.out for region 2345)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Wheirman</name></author>
		
	</entry>
</feed>