File tree Expand file tree Collapse file tree 1 file changed +7
-21
lines changed Expand file tree Collapse file tree 1 file changed +7
-21
lines changed Original file line number Diff line number Diff line change @@ -37,30 +37,16 @@ fn exec(cmd: &mut Command) -> ! {
37
37
fn raise_priority ( ) {
38
38
extern crate libc;
39
39
40
- use std:: io;
41
- use std:: mem;
42
-
43
40
unsafe {
44
- // Pin ourselves to just one core in case we're running on a multicore
45
- // system to try to normalize our results a bit
46
- let mut set: libc:: cpu_set_t = mem:: zeroed ( ) ;
47
- libc:: CPU_ZERO ( & mut set) ;
48
- libc:: CPU_SET ( 0 , & mut set) ;
49
- let r = libc:: sched_setaffinity ( libc:: getpid ( ) ,
50
- mem:: size_of_val ( & set) ,
51
- & set) ;
52
- if r != 0 {
53
- panic ! ( "failed to set affinity: {}" , io:: Error :: last_os_error( ) ) ;
54
- }
55
-
56
41
// Try to reduce jitter in wall time by increasing our priority to the
57
42
// maximum
58
- let r = libc:: setpriority ( libc:: PRIO_PROCESS as _ ,
59
- libc:: getpid ( ) as libc:: id_t ,
60
- -20 ) ;
61
- if r != 0 {
62
- // this requires elevated privileges, so just ignore if this fails,
63
- // and hope we've got elevated privileges on the actual perf bot.
43
+ for i in ( 1 ..21 ) . rev ( ) {
44
+ let r = libc:: setpriority ( libc:: PRIO_PROCESS as _ ,
45
+ libc:: getpid ( ) as libc:: id_t ,
46
+ -i) ;
47
+ if r == 0 {
48
+ break
49
+ }
64
50
}
65
51
}
66
52
}
You can’t perform that action at this time.
0 commit comments