-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTracing.ipf
91 lines (65 loc) · 2.8 KB
/
Tracing.ipf
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma TextEncoding="UTF-8"
#pragma rtGlobals=3 // Use modern global access method and strict wave access.
#pragma rtFunctionErrors=1
#pragma version=1.10
#pragma ModuleName=UTF_TestTracing
#if (IgorVersion() >= 9.00) && Exists("TUFXOP_Version") && (NumberByKey("BUILD", IgorInfo(0)) >= 38812)
static Function/S TracingTestLoadFile(string fName)
variable fNum
string data
Open/R/Z fNum as fName
REQUIRE(!V_flag)
FStatus fNum
data = PadString("", V_logEOF, 0x20)
FBinRead fNum, data
Close fNum
return data
End
static Function TracingTest()
string funcPath, procFileName, basePath
string proc1Text, proc2Text
variable fNum
SaveExperiment/P=home as "TestTracing.pxp"
funcPath = FunctionPath(GetIndependentModuleName() + "#TracingTest")
basePath = ParseFilePath(1, funcPath, ":", 1, 0)
proc1Text = TracingTestLoadFile(basePath + "test-tracing.ipf")
proc2Text = TracingTestLoadFile(basePath + "test-tracing_instrumented.ipf")
CHECK_EQUAL_STR(proc1Text, proc2Text)
End
static Function TracingTest2()
variable numThreads, numProcs, i, numRefLines
variable max_proc_lines = 10000
TestTracing2#TracingTest()
TUFXOP_GetStorage/N="IUTF_Testrun" wrefMain
numThreads = NumberByKey("Index", note(wrefMain))
WAVE/T procNames = IUTF_Tracing#GetTracedProcedureNames()
numProcs = DimSize(procNames, UTF_ROW)
CHECK_EQUAL_TEXTWAVES(procNames, {"test-tracing2.ipf"})
Make/FREE/D/N=(max_proc_lines, 3, numProcs) logData
for(i = 0; i < numThreads; i += 1)
WAVE/WAVE wrefThread = wrefMain[i]
WAVE logdataThread = wrefThread[0]
logdata += logdataThread[p][q][r]
endfor
Make/FREE/D/N=(max_proc_lines) logSimple, logRef
logSimple = logData[p][0][0] != 0
Make/FREE/D logRefGen = {14, 16, 18, 19, 21, 54, 23, 24, 26, 28, 30, 31, 33, 35, 36, 37, 39, 40, 41, 42, 44, 47, 48, 49, 51, 52, 53}
numRefLines = DimSize(logRefGen, UTF_ROW)
for(i = 0; i < numrefLines; i += 1)
logRef[logRefGen[i]] = 1
endfor
CHECK_EQUAL_WAVES(logSimple, logRef)
WAVE/WAVE instrMarker = IUTF_Tracing#GetInstrumentedMarker()
WAVE marker = instrMarker[0]
// verify instrumentation marker
Make/FREE=1/N=(DimSize(marker, UTF_ROW)) markerValues = marker[p][%INSTR]
Make/FREE markerRef = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 1, 0, 1, 1, 0, 1, 1, 1, 0, \
1, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0}
CHECK_EQUAL_WAVES(markerValues, markerRef)
// verify complexity marker
Make/FREE=1/N=(DimSize(marker, UTF_ROW)) markerValues = marker[p][%COMPLEX]
Make/FREE markerRef = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, \
1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
CHECK_EQUAL_WAVES(markerValues, markerRef)
End
#endif