1 | V3: Added check for missing samples as suggested by Chun-Tse. | ||
---|---|---|---|
2 | V2: Changed bc invocation to return 0 on success and 1 on error. | ||
3 | |||
1 | There is a known issue that the leader sampling is inconsistent, since | 4 | There is a known issue that the leader sampling is inconsistent, since |
2 | throttle only affect leader, not the slave. The detail is in [1]. To | 5 | throttle only affect leader, not the slave. The detail is in [1]. To |
3 | maintain test coverage, this patch sets a tolerance rate of 80% to | 6 | maintain test coverage, this patch sets a tolerance rate of 80% to |
4 | accommodate the throttled samples and prevent test failures due to | 7 | accommodate the throttled samples and prevent test failures due to |
5 | throttling. | 8 | throttling. |
... | ... | ||
8 | 11 | ||
9 | Signed-off-by: Chun-Tse Shao <ctshao@google.com> | 12 | Signed-off-by: Chun-Tse Shao <ctshao@google.com> |
10 | Suggested-by: Ian Rogers <irogers@google.com> | 13 | Suggested-by: Ian Rogers <irogers@google.com> |
11 | Suggested-by: Thomas Richter <tmricht@linux.ibm.com> | 14 | Suggested-by: Thomas Richter <tmricht@linux.ibm.com> |
12 | Tested-by: Thomas Richter <tmricht@linux.ibm.com> | 15 | Tested-by: Thomas Richter <tmricht@linux.ibm.com> |
16 | Signed-off-by: Thomas Richter <tmricht@linux.ibm.com> | ||
13 | --- | 17 | --- |
14 | tools/perf/tests/shell/record.sh | 25 +++++++++++++++++++------ | 18 | tools/perf/tests/shell/record.sh | 33 ++++++++++++++++++++++++++------ |
15 | 1 file changed, 19 insertions(+), 6 deletions(-) | 19 | 1 file changed, 27 insertions(+), 6 deletions(-) |
16 | 20 | ||
17 | diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh | 21 | diff --git a/tools/perf/tests/shell/record.sh b/tools/perf/tests/shell/record.sh |
18 | index XXXXXXX..XXXXXXX 100755 | 22 | index XXXXXXX..XXXXXXX 100755 |
19 | --- a/tools/perf/tests/shell/record.sh | 23 | --- a/tools/perf/tests/shell/record.sh |
20 | +++ b/tools/perf/tests/shell/record.sh | 24 | +++ b/tools/perf/tests/shell/record.sh |
... | ... | ||
48 | fi | 52 | fi |
49 | index=$(($index+1)) | 53 | index=$(($index+1)) |
50 | prev_cycles=$cycles | 54 | prev_cycles=$cycles |
51 | done < $script_output | 55 | done < $script_output |
52 | - echo "Basic leader sampling test [Success]" | 56 | - echo "Basic leader sampling test [Success]" |
53 | + if [[ "$(echo "scale=2; $invalid_counts/($invalid_counts+$valid_counts)" | bc)" > 1-$tolerance_rate ]] | 57 | + total_counts=$(bc <<< "$invalid_counts+$valid_counts") |
58 | + if (( $(bc <<< "$total_counts <= 0") )) | ||
54 | + then | 59 | + then |
55 | + echo "Leader sampling [Failed inconsistent cycles count]" | 60 | + echo "Leader sampling [No sample generated]" |
56 | + err=1 | 61 | + err=1 |
62 | + return | ||
63 | + fi | ||
64 | + isok=$(bc <<< "scale=2; if (($invalid_counts/$total_counts) < (1-$tolerance_rate)) { 0 } else { 1 };") | ||
65 | + if [ $isok -eq 1 ] | ||
66 | + then | ||
67 | + echo "Leader sampling [Failed inconsistent cycles count]" | ||
68 | + err=1 | ||
57 | + else | 69 | + else |
58 | + echo "Basic leader sampling test [Success]" | 70 | + echo "Basic leader sampling test [Success]" |
59 | + fi | 71 | + fi |
60 | } | 72 | } |
61 | 73 | ||
62 | test_topdown_leader_sampling() { | 74 | test_topdown_leader_sampling() { |
63 | -- | 75 | -- |
64 | 2.49.0.472.ge94155a9ec-goog | 76 | 2.49.0 | diff view generated by jsdifflib |