<print-env>

Purpose/Function

Prints out a trace of the environment in the context from which it is called.

Attributes

None.

Elements

None.

ReturnValues

None.

Examples

<ogrescript>
	<define procedure="computeTP" ARG_x0="double" ARG_y0="double" RET_t="double" RET_p="double">
		<assign name="RET_t" double="$E{sin ( ${ARG_x0} ) - cos ( ${ARG_y0} )}"/>
		<assign name="RET_p" double="$E{cos ( ${ARG_x0} ) - sin ( ${ARG_y0} )}"/>
	</define>

	<declare name="t" double="$E{pi}"/>
	<declare name="p" double="$E{e}"/>
	<declare name="monitor" configured="true"><new-object/></declare>
	<declare name="flag" string="FREE"/>
	<sleep time="4000"/>
	
	<parallel-block idPrefix="compute" copies="10" join="true">
		<synchronized taskName="sync1-${pTaskId}" on="${monitor}">
			<while condition="$E{true}">
				<if>
					<equals first="${flag}" second="LOCKED"/>
					<wait on="${monitor}" timeout="5000"/>
					<else><break/></else>
				</if>
			</while>
			<assign name="flag" string="LOCKED"/>
		</synchronized>
		<call procedure="computeTP" ARG_x0="${t}" ARG_y0="${p}"
										   RET_t="t" RET_p="p"/>
		<assign name="t-${pTaskId}" double="${t}" global="true"/>
		<echo message="t-${pTaskId} = ${t-${pTaskId}}"/>
		<synchronized taskName="sync2-${pTaskId}" on="${monitor}">
			<assign name="flag" string="FREE"/>	
			<notify on="${monitor}" all="true"/>
		</synchronized>
		<print-env/>
	</parallel-block>
</ogrescript>

The script above produces the following trace; note how each parallel-block (thread) identifies its environment; note also the frame stacks (0 and 1 are shared, 2 is local; 0 is global).


0 [OgreScript:Thread-1] INFO root - t-compute-1 = 0.9117339147869652
50 [OgreScript:Thread-3] INFO root - t-compute-3 = 0.6312336843476605
106 [OgreScript:Thread-1] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-1
frame 2:
pTaskId=compute-1
pTaskNumber=1
frame 1:
flag=LOCKED
t=0.6312336843476605
p=1.5996007830741492
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
[ compute-0=Thread[OgreScript:Thread-0,5,main] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
[ compute-9=Thread[OgreScript:Thread-9,5,main] ]
[ compute-3=Thread[OgreScript:Thread-3,5,main] ]
t-compute-3=0.6312336843476605
[ compute-6=Thread[OgreScript:Thread-6,5,main] ]
[ compute-7=Thread[OgreScript:Thread-7,5,main] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
[ compute-1=Thread[OgreScript:Thread-1,5,main] ]
[ compute-5=Thread[OgreScript:Thread-5,5,main] ]
[ compute-8=Thread[OgreScript:Thread-8,5,main] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

143 [OgreScript:Thread-3] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-3
frame 2:
pTaskId=compute-3
pTaskNumber=3
frame 1:
flag=FREE
t=0.6312336843476605
p=1.5996007830741492
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
[ compute-0=Thread[OgreScript:Thread-0,5,main] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
[ compute-9=Thread[OgreScript:Thread-9,5,main] ]
[ compute-3=Thread[OgreScript:Thread-3,5,main] ]
t-compute-3=0.6312336843476605
[ compute-6=Thread[OgreScript:Thread-6,5,main] ]
[ compute-7=Thread[OgreScript:Thread-7,5,main] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,main] ]
[ compute-8=Thread[OgreScript:Thread-8,5,main] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

202 [OgreScript:Thread-0] INFO root - t-compute-0 = 0.6189416335306359
208 [OgreScript:Thread-0] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-0
frame 2:
pTaskId=compute-0
pTaskNumber=0
frame 1:
flag=FREE
t=0.6189416335306359
p=-0.1922851054010799
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
[ compute-0=Thread[OgreScript:Thread-0,5,main] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
[ compute-9=Thread[OgreScript:Thread-9,5,main] ]
[ compute-3=Thread[OgreScript:Thread-3,5,] ]
t-compute-3=0.6312336843476605
[ compute-6=Thread[OgreScript:Thread-6,5,main] ]
t-compute-0=0.6189416335306359
[ compute-7=Thread[OgreScript:Thread-7,5,main] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,main] ]
[ compute-8=Thread[OgreScript:Thread-8,5,main] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

233 [OgreScript:Thread-8] INFO root - t-compute-8 = -0.40139665553473514
240 [OgreScript:Thread-8] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-8
frame 2:
pTaskId=compute-8
pTaskNumber=8
frame 1:
flag=FREE
t=-0.40139665553473514
p=1.0055953319729523
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
[ compute-0=Thread[OgreScript:Thread-0,5,] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
[ compute-9=Thread[OgreScript:Thread-9,5,main] ]
[ compute-3=Thread[OgreScript:Thread-3,5,] ]
t-compute-3=0.6312336843476605
[ compute-6=Thread[OgreScript:Thread-6,5,main] ]
t-compute-0=0.6189416335306359
[ compute-7=Thread[OgreScript:Thread-7,5,main] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
t-compute-8=-0.40139665553473514
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,main] ]
[ compute-8=Thread[OgreScript:Thread-8,5,main] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

252 [OgreScript:Thread-9] INFO root - t-compute-9 = -0.9262899301470848
280 [OgreScript:Thread-9] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-9
frame 2:
pTaskId=compute-9
pTaskNumber=9
frame 1:
flag=LOCKED
t=-0.9262899301470848
p=0.07603524500721315
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
[ compute-0=Thread[OgreScript:Thread-0,5,] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
[ compute-9=Thread[OgreScript:Thread-9,5,main] ]
[ compute-3=Thread[OgreScript:Thread-3,5,] ]
t-compute-3=0.6312336843476605
[ compute-6=Thread[OgreScript:Thread-6,5,main] ]
t-compute-9=-0.9262899301470848
t-compute-0=0.6189416335306359
[ compute-7=Thread[OgreScript:Thread-7,5,main] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
t-compute-8=-0.40139665553473514
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,main] ]
[ compute-8=Thread[OgreScript:Thread-8,5,] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

285 [OgreScript:Thread-6] INFO root - t-compute-6 = -1.7965071363085139
291 [OgreScript:Thread-6] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-6
frame 2:
pTaskId=compute-6
pTaskNumber=6
frame 1:
flag=FREE
t=-1.7965071363085139
p=0.52484192528583
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
t-compute-6=-1.7965071363085139
[ compute-0=Thread[OgreScript:Thread-0,5,] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
[ compute-9=Thread[OgreScript:Thread-9,5,] ]
[ compute-3=Thread[OgreScript:Thread-3,5,] ]
t-compute-3=0.6312336843476605
[ compute-6=Thread[OgreScript:Thread-6,5,main] ]
t-compute-9=-0.9262899301470848
t-compute-0=0.6189416335306359
[ compute-7=Thread[OgreScript:Thread-7,5,main] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
t-compute-8=-0.40139665553473514
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,main] ]
[ compute-8=Thread[OgreScript:Thread-8,5,] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

297 [OgreScript:Thread-7] INFO root - t-compute-7 = -1.8400384346139873
305 [OgreScript:Thread-7] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-7
frame 2:
pTaskId=compute-7
pTaskNumber=7
frame 1:
flag=FREE
t=-1.8400384346139873
p=-0.724875411213832
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
t-compute-6=-1.7965071363085139
[ compute-0=Thread[OgreScript:Thread-0,5,] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
[ compute-9=Thread[OgreScript:Thread-9,5,] ]
[ compute-3=Thread[OgreScript:Thread-3,5,] ]
t-compute-3=0.6312336843476605
t-compute-7=-1.8400384346139873
[ compute-6=Thread[OgreScript:Thread-6,5,] ]
t-compute-9=-0.9262899301470848
t-compute-0=0.6189416335306359
[ compute-7=Thread[OgreScript:Thread-7,5,main] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
t-compute-8=-0.40139665553473514
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,main] ]
[ compute-8=Thread[OgreScript:Thread-8,5,] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

317 [OgreScript:Thread-5] INFO root - t-compute-5 = -1.7125548086181266
324 [OgreScript:Thread-5] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-5
frame 2:
pTaskId=compute-5
pTaskNumber=5
frame 1:
flag=FREE
t=-1.7125548086181266
p=0.3970412571555702
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
t-compute-6=-1.7965071363085139
[ compute-0=Thread[OgreScript:Thread-0,5,] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
t-compute-5=-1.7125548086181266
[ compute-9=Thread[OgreScript:Thread-9,5,] ]
[ compute-3=Thread[OgreScript:Thread-3,5,] ]
t-compute-3=0.6312336843476605
t-compute-7=-1.8400384346139873
[ compute-6=Thread[OgreScript:Thread-6,5,] ]
t-compute-9=-0.9262899301470848
t-compute-0=0.6189416335306359
[ compute-7=Thread[OgreScript:Thread-7,5,] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
t-compute-8=-0.40139665553473514
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,main] ]
[ compute-8=Thread[OgreScript:Thread-8,5,] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

331 [OgreScript:Thread-4] INFO root - t-compute-4 = -1.9121782308082624
334 [OgreScript:Thread-4] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-4
frame 2:
pTaskId=compute-4
pTaskNumber=4
frame 1:
flag=FREE
t=-1.9121782308082624
p=-0.5279756339712427
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,main] ]
t-compute-6=-1.7965071363085139
[ compute-0=Thread[OgreScript:Thread-0,5,] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
t-compute-5=-1.7125548086181266
[ compute-9=Thread[OgreScript:Thread-9,5,] ]
[ compute-3=Thread[OgreScript:Thread-3,5,] ]
t-compute-3=0.6312336843476605
t-compute-7=-1.8400384346139873
[ compute-6=Thread[OgreScript:Thread-6,5,] ]
t-compute-4=-1.9121782308082624
t-compute-9=-0.9262899301470848
t-compute-0=0.6189416335306359
[ compute-7=Thread[OgreScript:Thread-7,5,] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
t-compute-8=-0.40139665553473514
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,] ]
[ compute-8=Thread[OgreScript:Thread-8,5,] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

340 [OgreScript:Thread-2] INFO root - t-compute-2 = -1.8061216047763977
342 [OgreScript:Thread-2] INFO ncsa.tools.ogrescript.tasks.OgreScriptBaseTask -
CONTENTS OF ENV: parallel_block_6_764756269.compute-2
frame 2:
pTaskId=compute-2
pTaskNumber=2
frame 1:
flag=FREE
t=-1.8061216047763977
p=0.16899609946395333
OgreScript: monitor=java.lang.Object@9db0e2
frame 0:
[ compute-4=Thread[OgreScript:Thread-4,5,] ]
t-compute-6=-1.7965071363085139
[ compute-0=Thread[OgreScript:Thread-0,5,] ]
OgreScript: computeTP=ncsa.tools.ogrescript.data.OgreScriptProcedure@fb0b0
t-compute-5=-1.7125548086181266
[ compute-9=Thread[OgreScript:Thread-9,5,] ]
t-compute-2=-1.8061216047763977
[ compute-3=Thread[OgreScript:Thread-3,5,] ]
t-compute-3=0.6312336843476605
t-compute-7=-1.8400384346139873
[ compute-6=Thread[OgreScript:Thread-6,5,] ]
t-compute-4=-1.9121782308082624
t-compute-9=-0.9262899301470848
t-compute-0=0.6189416335306359
[ compute-7=Thread[OgreScript:Thread-7,5,] ]
[ compute-2=Thread[OgreScript:Thread-2,5,main] ]
t-compute-8=-0.40139665553473514
[ compute-1=Thread[OgreScript:Thread-1,5,] ]
[ compute-5=Thread[OgreScript:Thread-5,5,] ]
[ compute-8=Thread[OgreScript:Thread-8,5,] ]
t-compute-1=0.9117339147869652
--------------------------------------------------------

  • No labels