fzsync: limit sampling time
PATCH v4 1/1 fzsync: limit sampling time
Sampling can take considerably longer time on single CPU and very slow systems. This patch limits sampling time to 1/2 of fuzzing runtime. If we don't have enough samples by that time, stop sampling and use stats we gathered so far.
--- include/tst_fuzzy_sync.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
Changes in v4:
- drop comment
- tweak info message when timeout is reached
include/tst_fuzzy_sync.h +14 -7
@@ -70,6 +70,9 @@ #ifndef TST_FUZZY_SYNC_H__ #define TST_FUZZY_SYNC_H__ +/* how much of exec time is sampling allowed to take */ +#define SAMPLING_SLICE 0.5f + /** Some statistics for a variable */ struct tst_fzsync_stat { float avg;
@@ -582,17 +585,21 @@ static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair)static inline int tst_fzsync_run_a (struct tst_fzsync_pair *pair) {int exit =0 ; +float rem_p =1 -tst_timeout_remaining () / pair->exec_time_start; + +if ((pair->exec_time_p *SAMPLING_SLICE < rem_p) + && (pair->sampling >0 )) { +tst_res (TINFO ,"Stopped sampling at %d (out of %d) samples, " +"sampling time reached 50% of the total time limit" , + pair->exec_loop, pair->min_samples); + pair->sampling =0 ; +tst_fzsync_pair_info (pair); + } -if (pair->exec_time_p - <1 -tst_timeout_remaining () / pair->exec_time_start) { +if (pair->exec_time_p < rem_p) {tst_res (TINFO ,"Exceeded execution time, requesting exit" ); exit =1 ; - -if (pair->sampling >0 ) { -tst_res (TWARN , -"Still sampling, consider increasing LTP_TIMEOUT_MUL" ); - } }if (++pair->exec_loop > pair->exec_loops) {
Signature · 1 line
1.8.3.1
PATCH v4 1/1 fzsync: limit sampling time
include/tst_fuzzy_sync.h static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair) · line 594
Quoted 7 lines · Jan Stancek
include/tst_fuzzy_sync.h +7
-0+float rem_p =1 -tst_timeout_remaining () / pair->exec_time_start; + +if ((pair->exec_time_p *SAMPLING_SLICE < rem_p) + && (pair->sampling >0 )) { +tst_res (TINFO ,"Stopped sampling at %d (out of %d) samples, " +"sampling time reached 50% of the total time limit" , + pair->exec_loop, pair->min_samples);
'50%' can not be quoted correctly here, since it makes compiler regard it as print symbol. Beside this tiny typo issue, I have no more comment for V4. LGTM.
../../include/tst_fuzzy_sync.h:592:3: warning: ' ' flag used with ‘%o’ gnu_printf format [-Wformat=]
tst_res(TINFO, "Stopped sampling at %d (out of %d) samples, " ^../../include/tst_fuzzy_sync.h:592:3: warning: format ‘%o’ expects a matching ‘unsigned int’ argument [-Wformat=]
# ./shmctl05 tst_test.c:1085: INFO: Timeout per run is 0h 00m 20s ../../../../../include/tst_fuzzy_sync.h:594: INFO: Stopped sampling at 166 (out of 1024) samples, sampling time reached 5036122336437f the total time limit
Signature · 2 lines
Regards, Li Wang
PATCH v4 1/1 fzsync: limit sampling time
----- Original Message -----
Quoted 12 lines · Jan Stancek
Quoted 10 lines
include/tst_fuzzy_sync.h +5
-0+float rem_p =1 -tst_timeout_remaining () / pair->exec_time_start; + +if ((pair->exec_time_p *SAMPLING_SLICE < rem_p) + && (pair->sampling >0 )) { + tst_res(TINFO, "Stopped sampling at %d (out of %d) samples,"
+ "sampling time reached 50% of the total time
limit",
+pair->exec_loop,pair->min_samples);
Quoted 3 lines
'50%' can not be quoted correctly here, since it makes compiler regard it as print symbol. Beside this tiny typo issue, I have no more comment for V4. LGTM.
*facepalm*, thanks for catching that.
Quoted 18 lines
../../include/tst_fuzzy_sync.h:592:3: warning: ' ' flag used with ‘%o’gnu_printfformat [-Wformat=]
tst_res(TINFO, "Stopped sampling at %d (out of %d) samples, " ^../../include/tst_fuzzy_sync.h:592:3: warning: format ‘%o’ expects a matching ‘unsigned int’ argument [-Wformat=]# ./shmctl05 tst_test.c:1085: INFO: Timeout per run is 0h 00m 20s ../../../../../include/tst_fuzzy_sync.h:594: INFO: Stopped sampling at 166 (out of 1024) samples, sampling time reached 5036122336437f the total time limit--
Regards,
Li Wang
PATCH v4 1/1 fzsync: limit sampling time
In reply to Jan Stancek----- Original Message -----
Quoted 6 lines
Fixes #429Sampling can take considerably longer time on single CPU and very slow systems. This patch limits sampling time to 1/2 of fuzzing runtime. If we don't have enough samples by that time, stop sampling and use stats we gathered so far.
@Richard: Are you OK with v4 (with %% typo fixed)?
Quoted 61 lines
Signed-off-by Jan Stancek <[email protected]>--- include/tst_fuzzy_sync.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)Changes in v4:
- drop comment
- tweak info message when timeout is reachedinclude/tst_fuzzy_sync.h +14
-7@@ -70,6 +70,9 @@ #ifndef TST_FUZZY_SYNC_H__ #define TST_FUZZY_SYNC_H__ +/* how much of exec time is sampling allowed to take */ +#define SAMPLING_SLICE 0.5f + /** Some statistics for a variable */ struct tst_fzsync_stat { float avg;@@ -582,17 +585,21 @@ static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair)static inline int tst_fzsync_run_a (struct tst_fzsync_pair *pair) {int exit =0 ; +float rem_p =1 -tst_timeout_remaining () / pair->exec_time_start; + +if ((pair->exec_time_p *SAMPLING_SLICE < rem_p) + && (pair->sampling >0 )) { +tst_res (TINFO ,"Stopped sampling at %d (out of %d) samples, " +"sampling time reached 50% of the total time limit" , + pair->exec_loop, pair->min_samples); + pair->sampling =0 ; +tst_fzsync_pair_info (pair); + } -if (pair->exec_time_p - <1 -tst_timeout_remaining () / pair->exec_time_start) { +if (pair->exec_time_p < rem_p) {tst_res (TINFO ,"Exceeded execution time, requesting exit" ); exit =1 ; - -if (pair->sampling >0 ) { -tst_res (TWARN , -"Still sampling, consider increasing LTP_TIMEOUT_MUL" ); - } }if (++pair->exec_loop >
pair->exec_loops) {
--
1.8.3.1--
Mailing list info: https://lists.linux.it/listinfo/ltp
PATCH v4 1/1 fzsync: limit sampling time
Hell Jan,
Quoted 9 lines · Jan Stancek
----- Original Message -----
Quoted 6 lines
Fixes #429Sampling can take considerably longer time on single CPU and very slow systems. This patch limits sampling time to 1/2 of fuzzing runtime. If we don't have enough samples by that time, stop sampling and use stats we gathered so far.
@Richard: Are you OK with v4 (with %% typo fixed)?
Yes, thanks.
Quoted 62 lines
Quoted 62 lines
Signed-off-by Jan Stancek <[email protected]>--- include/tst_fuzzy_sync.h | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)Changes in v4:
- drop comment
- tweak info message when timeout is reachedinclude/tst_fuzzy_sync.h +14
-7@@ -70,6 +70,9 @@ #ifndef TST_FUZZY_SYNC_H__ #define TST_FUZZY_SYNC_H__ +/* how much of exec time is sampling allowed to take */ +#define SAMPLING_SLICE 0.5f + /** Some statistics for a variable */ struct tst_fzsync_stat { float avg;@@ -582,17 +585,21 @@ static inline void tst_fzsync_wait_b(struct tst_fzsync_pair *pair)static inline int tst_fzsync_run_a (struct tst_fzsync_pair *pair) {int exit =0 ; +float rem_p =1 -tst_timeout_remaining () / pair->exec_time_start; + +if ((pair->exec_time_p *SAMPLING_SLICE < rem_p) + && (pair->sampling >0 )) { +tst_res (TINFO ,"Stopped sampling at %d (out of %d) samples, " +"sampling time reached 50% of the total time limit" , + pair->exec_loop, pair->min_samples); + pair->sampling =0 ; +tst_fzsync_pair_info (pair); + } -if (pair->exec_time_p - <1 -tst_timeout_remaining () / pair->exec_time_start) { +if (pair->exec_time_p < rem_p) {tst_res (TINFO ,"Exceeded execution time, requesting exit" ); exit =1 ; - -if (pair->sampling >0 ) { -tst_res (TWARN , -"Still sampling, consider increasing LTP_TIMEOUT_MUL" ); - } }if (++pair->exec_loop >
pair->exec_loops) {
--
1.8.3.1--
Mailing list info: https://lists.linux.it/listinfo/ltp
Signature · 2 lines
Thank you, Richard.
PATCH v4 1/1 fzsync: limit sampling time
----- Original Message -----
Quoted 7 lines
Hell Jan,
Quoted 3 lines · Jan Stancek
----- Original Message -----
Quoted 2 lines
Fixes #429
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Sampling can take considerably longer time on single CPU and very slow systems. This patch limits sampling time to 1/2 of fuzzing runtime. If we don't have enough samples by that time, stop sampling and use stats we gathered so far.
@Richard: Are you OK with v4 (with %% typo fixed)?
Yes, thanks.
Pushed.
Regards,
Jan