⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 installation instructions for powertossim.mht

📁 Installation instructions for PowerTOSSIM.rar
💻 MHT
字号:
From: <由 Microsoft Internet Explorer 5 保存>
Subject: Installation instructions for PowerTOSSIM
Date: Tue, 31 Jul 2007 19:34:27 +0800
MIME-Version: 1.0
Content-Type: text/html;
	charset="gb2312"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.eecs.harvard.edu/~shnayder/ptossim/install.html
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Installation instructions for PowerTOSSIM</TITLE>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2900.2180" name=3DGENERATOR></HEAD>
<BODY>
<CENTER>
<H2>Installation instructions for PowerTOSSIM </H2></CENTER>
<UL>
  <LI><A=20
  =
href=3D"http://www.eecs.harvard.edu/~shnayder/ptossim/install.html#base">=
Basic=20
  installation</A>=20
  <LI><A=20
  =
href=3D"http://www.eecs.harvard.edu/~shnayder/ptossim/install.html#mica2"=
>Using=20
  the mica2 radio stack</A>=20
  <LI><A=20
  =
href=3D"http://www.eecs.harvard.edu/~shnayder/ptossim/install.html#tinyvi=
z">Using=20
  the tinyviz plugin</A>=20
  <LI><A=20
  =
href=3D"http://www.eecs.harvard.edu/~shnayder/ptossim/install.html#cpu">U=
sing=20
  the CPU cycle counting component</A>=20
  <LI><A=20
  =
href=3D"http://www.eecs.harvard.edu/~shnayder/ptossim/install.html#cygwin=
">Using=20
  the CPU cycle counting code in Cygwin</A> </LI></UL>
<P><B>NOTE: If you find something unclear or incorrect on this page, =
please=20
email <A href=3D"mailto:shnayder@spamsmapspam.eecs.harvard.edu">me</A>. =
Also email=20
if you find bugs in the code :)</B> <A name=3Dbase>
<H3>Basic instructions</H3>
<P>The first step is to get the code. If you have a recent version of =
TinyOS=20
(after 1.1.10 I think), you already have it, as that's when it was moved =
into=20
the main tree in the sourceforge TinyOS repository. If you're using an =
older=20
version of TinyOS, you should upgrade :) <!--=0A=
(cvs.sourceforge.net:/cvsroot/tinyos/tinyos-1.x/tos/platform/pc), so=0A=
all you have to do is update your repository.  If you are using the=0A=
CVS version of TinyOS, just run:=0A=
=0A=
<p>=0A=
<tt>=0A=
$ cd $TOSDIR/platform/pc <br>=0A=
$ cvs update=0A=
</tt>=0A=
=0A=
<p>=0A=
You may also need to do a 'cvs update -d' in $TOSDIR/types and=0A=
$TOSROOT/tools/scripts to get other necessary changes.=0A=
-->
<P>Once you have the code, do the following:=20
<OL>
  <LI>recompile your app:=20
  <P><TT>$ make pc</TT> </P>
  <LI>make sure DBG includes POWER. If you don't need any other =
debugging=20
  messages, this reduces to (for the appropriate shell):=20
  <P><TT>bash$ export DBG=3Dpower</TT>=20
  <P><TT>tcsh% setenv DBG power</TT> </P>
  <LI>run main.exe with the -p flag and save the output to a file. For =
example=20
  <P><TT>./build/pc/main.exe -t=3D60 -p 10 &gt; myapp.trace</TT> </P>
  <LI>run postprocess.py on the resulting trace:=20
  <P><TT>$TOSROOT/tools/scripts/PowerTOSSIM/postprocess.py --sb=3D0 --em =

  $TOSROOT/tools/scripts/PowerTOSSIM/mica2_energy_model.txt =
myapp.trace</TT>=20
  <P>The --sb parameter specifies whether to assume that the motes have =
a sensor=20
  board attached. The --em parameter specifies the energy model. Run=20
  postprocess.py --help for details on other options.=20
  <P>Here's the output we get for the trace of a CntToLedsAndRfm run =
with=20
  <TT>main.exe -t=3D60 -p 2</TT>: <PRE>Mote 0, cpu total: 719.503906
Mote 0, radio total: 1235.255862
Mote 0, adc total: 0.000000
Mote 0, leds total: 571.570576
Mote 0, sensor total: 0.000000
Mote 0, eeprom total: 0.000000
Mote 0, cpu_cycle total: 0.000000
Mote 0, Total energy: 2526.330344

Mote 1, cpu total: 635.394462
Mote 1, radio total: 1090.990102
Mote 1, adc total: 0.000000
Mote 1, leds total: 504.416514
Mote 1, sensor total: 0.000000
Mote 1, eeprom total: 0.000000
Mote 1, cpu_cycle total: 0.000000
Mote 1, Total energy: 2230.801078
</PRE>By default, the postprocessor prints the total energy used by each =

  component on each mote. The --detail flag can be used to generate =
current vs=20
  time data files, one per simulated mote. </LI></OL><A name=3Dmica2>
<H3>Using the mica2 radio stack</H3>By default, TOSSIM uses an old =
version of=20
the mica radio stack, which does not support power management and tuning =

transmission power. PowerTOSSIM includes a port of the mica2 radio =
stack, so it=20
is now possible to run programs that take advantage of the CC1000's =
power=20
management features. To use it include=20
<P><TT>PFLAGS +=3D -I%T/platform/pc/CC1000Radio</TT>=20
<P>in your application Makefile. <A name=3Dtinyviz>
<H3>Using the TinyViz plugin</H3>
<P>The TinyViz plugin allows you to see the power state of the you =
application=20
as it's running. It is in the main tree, so run=20
<P><TT>$ cd $TOSROOT/tools/java/net/tinyos/sim/plugins <BR>$ cvs =
update<BR>$ cd=20
$TOSROOT/tools/java/net/tinyos/sim/<BR>$ make </TT>
<P>To use the plugin, run the simulation as usual, making sure to =
include the -p=20
flag and have POWER as part of DBG. For example: <PRE>$ setenv DBG power
$ tinyviz -run 'main.exe -p' 5
</PRE><A name=3Dcpu>
<H3>Using the CPU cycle counting code</H3>
<P><EM>Disclaimer: This code is currently made up of a bunch of hacks, =
mostly=20
due to the fact that I don't really know ML</EM>=20
<P>The main component that actually does the transformation is currently =

provided as an x86 linux binary (cilly.asm.exe). This is a compiled =
version of=20
<A href=3D"http://manju.cs.berkeley.edu/cil/">CIL</A> with a module to =
add a=20
counter to every basic block. The module code is in scripts/counter.ml, =
so if=20
x86 linux doesn't work for you, install CIL, add in the counter.ml =
module, and=20
generate your own cilly program :)=20
<P><EM>Note: Read if you're compiling your own version of CIL:</EM> =
Getting CIL=20
to process the output of the nesC compiler requires a small modification =
to make=20
it recognize '$' as a valid character for identifiers. Namely, you have =
to=20
modify the following two lines in <TT>src/frontc/clexer.mll</TT> to add =
the '$':=20

<P><PRE>let ident =3D (letter|'_')(letter|decdigit|'_'|'$')*=20
let attribident =3D (letter|'_')(letter|decdigit|'_'|':'|'$')
</PRE>
<P>Once you have a version of cilly that works on your machine, make =
sure that:=20
(This assumes that you already have basic PowerTOSSIM set up as =
described <A=20
href=3D"http://www.eecs.harvard.edu/~shnayder/ptossim/install.html#base">=
above</A>.)=20

<UL>
  <LI>You makefile is set up to compile mica2 code with debugging (-g). =
<EM>This=20
  is very important!!!</EM> Add=20
  <P><TT>OPTFLAGS :=3D -g -O0</TT>=20
  <P>to the=20
  <P><TT>ifeq ($(PLATFORM), mica2)</TT>=20
  <P>section. </P>
  <LI>The TOSDIR environment variable is set to point to your tinyos =
tos/=20
  directory </LI></UL>Then, to set up cpu cycle counting for MyApp, run: =
<PRE>$ cd $TOSROOT/apps/MyApp
$ $TOSROOT/tools/scripts/PowerTOSSIM/compile.pl
... lots of silly warnings here ...  But there shouldn't be any errors.
$ cd build/pc
$ ./a.out -cpuprof 1
...
0: POWER: Mote 0 CPU_CYCLES 5985780.5 at 38191327
0: POWER: Mote 0 CPU_CYCLES 6059924.0 at 38591427
0: POWER: Mote 0 CPU_CYCLES 6133961.0 at 38991527
0: POWER: Mote 0 CPU_CYCLES 6209839.5 at 39391627
...
</PRE>
<P>When the run finishes (use -t=3DTIME), the bb_exec_cnt file will have =
execution=20
counts for each basic block. The basic block to line number mapping is =
in=20
bb_linenum_map, and the basic block to cycle count in bb_cycle_map. The=20
cpuprof.py script can do some processing of these files to give sorted =
basic=20
block or cycle execution counts.=20
<P><A name=3Dcygwin>
<H3>Using the CPU cycle counting code in Cygwin</H3>If you're trying to =
use the=20
CPU cycle counting code on Cygwin, you'll need to compile your own =
version of=20
cilly and potentially make some other changes. Turkmen Canli wrote up a =
<A=20
href=3D"http://www2.uic.edu/~tcanli1/cpucyclecountingcode.htm">page with =
the steps=20
he followed to get it to work.</A>=20
<P><A href=3D"mailto:shnayder@spamsmap.eecs.harvard.edu">Email me</A> =
if/when=20
something breaks, or if you have questions. Patches are also appreciated =
:)=20
</P></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -