...
...
9
Signed-off-by: Chun-Tse Shao <ctshao@google.com>
9
Signed-off-by: Chun-Tse Shao <ctshao@google.com>
10
Suggested-by: Ian Rogers <irogers@google.com>
10
Suggested-by: Ian Rogers <irogers@google.com>
11
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
11
Suggested-by: Thomas Richter <tmricht@linux.ibm.com>
12
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
12
Tested-by: Thomas Richter <tmricht@linux.ibm.com>
13
---
13
---
14
tools/perf/tests/shell/record.sh | 25 +++++++++++++++++++------
14
tools/perf/tests/shell/record.sh | 28 ++++++++++++++++++++++++----
15
1 file changed, 19 insertions(+), 6 deletions(-)
15
1 file changed, 24 insertions(+), 4 deletions(-)
16
16
17
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
17
diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh
18
index XXXXXXX..XXXXXXX 100755
18
index XXXXXXX..XXXXXXX 100755
19
--- a/tools/perf/tests/shell/record.sh
19
--- a/tools/perf/tests/shell/record.sh
20
+++ b/tools/perf/tests/shell/record.sh
20
+++ b/tools/perf/tests/shell/record.sh
21
@@ -XXX,XX +XXX,XX @@ test_leader_sampling() {
21
@@ -XXX,XX +XXX,XX @@ test_leader_sampling() {
22
err=1
23
return
24
fi
22
fi
25
+ perf script -i "${perfdata}" | grep brstack > $script_output
23
index=0
24
perf script -i "${perfdata}" > $script_output
26
+ # Check if the two instruction counts are equal in each record.
25
+ # Check if the two instruction counts are equal in each record.
27
+ # However, the throttling code doesn't consider event grouping. During throttling, only the
26
+ # However, the throttling code doesn't consider event grouping. During throttling, only the
28
+ # leader is stopped, causing the slave's counts significantly higher. To temporarily solve this,
27
+ # leader is stopped, causing the slave's counts significantly higher. To temporarily solve this,
29
+ # let's set the tolerance rate to 80%.
28
+ # let's set the tolerance rate to 80%.
30
+ # TODO: Revert the code for tolerance once the throttling mechanism is fixed.
29
+ # TODO: Revert the code for tolerance once the throttling mechanism is fixed.
31
index=0
32
- perf script -i "${perfdata}" > $script_output
33
+ valid_counts=0
30
+ valid_counts=0
34
+ invalid_counts=0
31
+ invalid_counts=0
35
+ tolerance_rate=0.8
32
+ tolerance_rate=0.8
36
while IFS= read -r line
33
while IFS= read -r line
37
do
34
do
...
...
47
+ valid_counts=$(($valid_counts+1))
44
+ valid_counts=$(($valid_counts+1))
48
fi
45
fi
49
index=$(($index+1))
46
index=$(($index+1))
50
prev_cycles=$cycles
47
prev_cycles=$cycles
51
done < $script_output
48
done < $script_output
52
- echo "Basic leader sampling test [Success]"
49
+ total_counts=$(bc <<< "$invalid_counts+$valid_counts")
53
+ if [[ "$(echo "scale=2; $invalid_counts/($invalid_counts+$valid_counts)" | bc)" > 1-$tolerance_rate ]]
50
+ if (( $(bc <<< "$total_counts <= 0") ))
51
+ then
52
+ echo "Leader sampling [No sample generated]"
53
+ err=1
54
+ return
55
+ fi
56
+ if (( $(bc <<< "scale=3; $invalid_counts/$total_counts > 1-$tolerance_rate") ))
54
+ then
57
+ then
55
+ echo "Leader sampling [Failed inconsistent cycles count]"
58
+ echo "Leader sampling [Failed inconsistent cycles count]"
56
+ err=1
59
+ err=1
57
+ else
60
+ return
58
+ echo "Basic leader sampling test [Success]"
59
+ fi
61
+ fi
62
echo "Basic leader sampling test [Success]"
60
}
63
}
61
64
62
test_topdown_leader_sampling() {
63
--
65
--
64
2.49.0.472.ge94155a9ec-goog
66
2.49.0.504.g3bcea36a83-goog
diff view generated by jsdifflib