Skip to content

Commit df68409

Browse files
Atomicity is enough for intervals, no happens-before relation
1 parent 7038635 commit df68409

4 files changed

Lines changed: 23 additions & 23 deletions

File tree

profiling/src/allocation/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl AllocationProfilingStats {
4545
fn new() -> AllocationProfilingStats {
4646
// Safety: this will only error if lambda <= 0
4747
let poisson =
48-
Poisson::new(ALLOCATION_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64).unwrap();
48+
Poisson::new(ALLOCATION_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64).unwrap();
4949
let mut stats = AllocationProfilingStats {
5050
next_sample: 0,
5151
poisson,
@@ -137,11 +137,11 @@ pub fn alloc_prof_first_rinit() {
137137
return;
138138
}
139139

140-
ALLOCATION_PROFILING_INTERVAL.store(sampling_distance as u64, Ordering::SeqCst);
140+
ALLOCATION_PROFILING_INTERVAL.store(sampling_distance as u64, Ordering::Relaxed);
141141

142142
trace!(
143143
"Memory allocation profiling initialized with a sampling distance of {} bytes.",
144-
ALLOCATION_PROFILING_INTERVAL.load(Ordering::SeqCst)
144+
ALLOCATION_PROFILING_INTERVAL.load(Ordering::Relaxed)
145145
);
146146
}
147147

profiling/src/exception.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ impl ExceptionProfilingStats {
4040
fn new() -> ExceptionProfilingStats {
4141
// Safety: this will only error if lambda <= 0
4242
let poisson =
43-
Poisson::new(EXCEPTION_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64).unwrap();
43+
Poisson::new(EXCEPTION_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64).unwrap();
4444
let mut stats = ExceptionProfilingStats {
4545
next_sample: 0,
4646
poisson,
@@ -169,7 +169,7 @@ pub fn exception_profiling_first_rinit() {
169169
return;
170170
}
171171

172-
EXCEPTION_PROFILING_INTERVAL.store(sampling_distance, Ordering::SeqCst);
172+
EXCEPTION_PROFILING_INTERVAL.store(sampling_distance, Ordering::Relaxed);
173173

174174
info!("Exception profiling initialized with sampling distance: {sampling_distance}");
175175
}

profiling/src/io/mod.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -545,42 +545,42 @@ impl IOProfilingStats {
545545
thread_local! {
546546
static SOCKET_READ_TIME_PROFILING_STATS: RefCell<IOProfilingStats> = RefCell::new(
547547
IOProfilingStats::new(
548-
SOCKET_READ_TIME_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
548+
SOCKET_READ_TIME_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
549549
)
550550
);
551551
static SOCKET_WRITE_TIME_PROFILING_STATS: RefCell<IOProfilingStats> = RefCell::new(
552552
IOProfilingStats::new(
553-
SOCKET_WRITE_TIME_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
553+
SOCKET_WRITE_TIME_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
554554
)
555555
);
556556
static FILE_READ_TIME_PROFILING_STATS: RefCell<IOProfilingStats> = RefCell::new(
557557
IOProfilingStats::new(
558-
FILE_READ_TIME_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
558+
FILE_READ_TIME_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
559559
)
560560
);
561561
static FILE_WRITE_TIME_PROFILING_STATS: RefCell<IOProfilingStats> = RefCell::new(
562562
IOProfilingStats::new(
563-
FILE_WRITE_TIME_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
563+
FILE_WRITE_TIME_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
564564
)
565565
);
566566
static SOCKET_READ_SIZE_PROFILING_STATS: RefCell<IOProfilingStats> = RefCell::new(
567567
IOProfilingStats::new(
568-
SOCKET_READ_SIZE_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
568+
SOCKET_READ_SIZE_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
569569
)
570570
);
571571
static SOCKET_WRITE_SIZE_PROFILING_STATS: RefCell<IOProfilingStats> = RefCell::new(
572572
IOProfilingStats::new(
573-
SOCKET_WRITE_SIZE_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
573+
SOCKET_WRITE_SIZE_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
574574
)
575575
);
576576
static FILE_READ_SIZE_PROFILING_STATS: RefCell<IOProfilingStats> = RefCell::new(
577577
IOProfilingStats::new(
578-
FILE_READ_SIZE_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
578+
FILE_READ_SIZE_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
579579
)
580580
);
581581
static FILE_WRITE_SIZE_PROFILING_STATS: RefCell<IOProfilingStats> = RefCell::new(
582582
IOProfilingStats::new(
583-
FILE_WRITE_SIZE_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
583+
FILE_WRITE_SIZE_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
584584
)
585585
);
586586
}

profiling/src/profiling/mod.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ impl TimeCollector {
352352
let upscaling_info = UpscalingInfo::Poisson {
353353
sum_value_offset: alloc_size_offset,
354354
count_value_offset: alloc_samples_offset,
355-
sampling_distance: ALLOCATION_PROFILING_INTERVAL.load(Ordering::SeqCst),
355+
sampling_distance: ALLOCATION_PROFILING_INTERVAL.load(Ordering::Relaxed),
356356
};
357357
let values_offset = [alloc_size_offset, alloc_samples_offset];
358358
match profile.add_upscaling_rule(&values_offset, "", "", upscaling_info) {
@@ -392,69 +392,69 @@ impl TimeCollector {
392392
&mut profile,
393393
socket_read_time_offset,
394394
socket_read_time_samples_offset,
395-
SOCKET_READ_TIME_PROFILING_INTERVAL.load(Ordering::SeqCst),
395+
SOCKET_READ_TIME_PROFILING_INTERVAL.load(Ordering::Relaxed),
396396
"socket read time samples",
397397
);
398398

399399
add_io_upscaling_rule(
400400
&mut profile,
401401
socket_write_time_offset,
402402
socket_write_time_samples_offset,
403-
SOCKET_WRITE_TIME_PROFILING_INTERVAL.load(Ordering::SeqCst),
403+
SOCKET_WRITE_TIME_PROFILING_INTERVAL.load(Ordering::Relaxed),
404404
"socket write time samples",
405405
);
406406

407407
add_io_upscaling_rule(
408408
&mut profile,
409409
file_read_time_offset,
410410
file_read_time_samples_offset,
411-
FILE_READ_TIME_PROFILING_INTERVAL.load(Ordering::SeqCst),
411+
FILE_READ_TIME_PROFILING_INTERVAL.load(Ordering::Relaxed),
412412
"file read time samples",
413413
);
414414

415415
add_io_upscaling_rule(
416416
&mut profile,
417417
file_write_time_offset,
418418
file_write_time_samples_offset,
419-
FILE_WRITE_TIME_PROFILING_INTERVAL.load(Ordering::SeqCst),
419+
FILE_WRITE_TIME_PROFILING_INTERVAL.load(Ordering::Relaxed),
420420
"file write time samples",
421421
);
422422

423423
add_io_upscaling_rule(
424424
&mut profile,
425425
socket_read_size_offset,
426426
socket_read_size_samples_offset,
427-
SOCKET_READ_SIZE_PROFILING_INTERVAL.load(Ordering::SeqCst),
427+
SOCKET_READ_SIZE_PROFILING_INTERVAL.load(Ordering::Relaxed),
428428
"socket read size samples",
429429
);
430430

431431
add_io_upscaling_rule(
432432
&mut profile,
433433
socket_write_size_offset,
434434
socket_write_size_samples_offset,
435-
SOCKET_WRITE_SIZE_PROFILING_INTERVAL.load(Ordering::SeqCst),
435+
SOCKET_WRITE_SIZE_PROFILING_INTERVAL.load(Ordering::Relaxed),
436436
"socket write size samples",
437437
);
438438

439439
add_io_upscaling_rule(
440440
&mut profile,
441441
file_read_size_offset,
442442
file_read_size_samples_offset,
443-
FILE_READ_SIZE_PROFILING_INTERVAL.load(Ordering::SeqCst),
443+
FILE_READ_SIZE_PROFILING_INTERVAL.load(Ordering::Relaxed),
444444
"file read size samples",
445445
);
446446

447447
add_io_upscaling_rule(
448448
&mut profile,
449449
file_write_size_offset,
450450
file_write_size_samples_offset,
451-
FILE_WRITE_SIZE_PROFILING_INTERVAL.load(Ordering::SeqCst),
451+
FILE_WRITE_SIZE_PROFILING_INTERVAL.load(Ordering::Relaxed),
452452
"file write size samples",
453453
);
454454
}
455455
if let Some(exception_samples_offset) = exception_samples_offset {
456456
let upscaling_info = UpscalingInfo::Proportional {
457-
scale: EXCEPTION_PROFILING_INTERVAL.load(Ordering::SeqCst) as f64,
457+
scale: EXCEPTION_PROFILING_INTERVAL.load(Ordering::Relaxed) as f64,
458458
};
459459
let values_offset = [exception_samples_offset];
460460
match profile.add_upscaling_rule(&values_offset, "", "", upscaling_info) {

0 commit comments

Comments
 (0)