Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3312405

Browse files
committed
Fix incorrect DROP_SIZE usage
Previously, measure() only recorded timings for indices in the middle range [DROP_SIZE, N_MEASURES - DROP_SIZE), while update_statistics() assumed all entries were starting available from index 10. This mismatch allowed zero-valued exec_times from unmeasured head and tail indices to be included in the t-test, reducing sample means, inflating variances, and suppressing the t-value, which may lead to incorrect results or prevent detection thresholds from being reached. After the fix, all samples are measured and update_statistics() discards DROP_SIZE samples at both ends. This ensures correct sample accounting, prevents overestimating the number of measurements required, and avoids false negatives due to uninitialized timing data. Change-Id: Ibb1515043da5f56d72fe34fd5c78e2283df9a993
1 parent 55065d7 commit 3312405

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

‎dudect/constant.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ bool measure(int64_t *before_ticks,
7777

7878
switch (mode) {
7979
case DUT(insert_head):
80-
for (size_t i = DROP_SIZE; i < N_MEASURES-DROP_SIZE; i++) {
80+
for (size_t i = 0; i < N_MEASURES; i++) {
8181
char *s = get_random_string();
8282
dut_new();
8383
dut_insert_head(
@@ -94,7 +94,7 @@ bool measure(int64_t *before_ticks,
9494
}
9595
break;
9696
case DUT(insert_tail):
97-
for (size_t i = DROP_SIZE; i < N_MEASURES-DROP_SIZE; i++) {
97+
for (size_t i = 0; i < N_MEASURES; i++) {
9898
char *s = get_random_string();
9999
dut_new();
100100
dut_insert_head(
@@ -111,7 +111,7 @@ bool measure(int64_t *before_ticks,
111111
}
112112
break;
113113
case DUT(remove_head):
114-
for (size_t i = DROP_SIZE; i < N_MEASURES-DROP_SIZE; i++) {
114+
for (size_t i = 0; i < N_MEASURES; i++) {
115115
dut_new();
116116
dut_insert_head(
117117
get_random_string(),
@@ -129,7 +129,7 @@ bool measure(int64_t *before_ticks,
129129
}
130130
break;
131131
case DUT(remove_tail):
132-
for (size_t i = DROP_SIZE; i < N_MEASURES-DROP_SIZE; i++) {
132+
for (size_t i = 0; i < N_MEASURES; i++) {
133133
dut_new();
134134
dut_insert_head(
135135
get_random_string(),
@@ -147,7 +147,7 @@ bool measure(int64_t *before_ticks,
147147
}
148148
break;
149149
default:
150-
for (size_t i = DROP_SIZE; i < N_MEASURES-DROP_SIZE; i++) {
150+
for (size_t i = 0; i < N_MEASURES; i++) {
151151
dut_new();
152152
dut_insert_head(
153153
get_random_string(),

‎dudect/fixture.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ static void update_statistics(const int64_t *exec_times,
103103
uint8_t *classes,
104104
int64_t *percentiles)
105105
{
106-
for (size_t i = 0; i < N_MEASURES; i++) {
106+
for (size_t i = DROP_SIZE; i < N_MEASURES-DROP_SIZE; i++) {
107107
int64_t difference = exec_times[i];
108108
/* CPU cycle counter overflowed or dropped measurement */
109109
if (difference <= 0)

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /