Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Fix incorrect use of atomic variable in src/perf_trace.rs" #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
## Pending
- [\#47](https://github.com/arkworks-rs/std/pull/47) Fix incorrect use of atomic variable in `src/perf_trace.rs`

### Breaking changes

Expand Down
8 changes: 5 additions & 3 deletions src/perf_trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,11 @@ pub mod inner {

let msg = $msg();
let start_info = "Start:".yellow().bold();
let indent_amount = 2 * NUM_INDENT.fetch_add(1, Ordering::Relaxed);
let indent_amount = 2 * NUM_INDENT.fetch_add(0, Ordering::Relaxed);
let indent = compute_indent(indent_amount);

$crate::perf_trace::println!("{}{:8} {}", indent, start_info, msg);
NUM_INDENT.fetch_add(1, Ordering::Relaxed);
$crate::perf_trace::TimerInfo {
msg: msg.to_string(),
time: Instant::now(),
Expand Down Expand Up @@ -109,7 +110,8 @@ pub mod inner {
let end_info = "End:".green().bold();
let message = format!("{} {}", $time.msg, $msg());

let indent_amount = 2 * NUM_INDENT.fetch_sub(1, Ordering::Relaxed);
NUM_INDENT.fetch_sub(1, Ordering::Relaxed);
let indent_amount = 2 * NUM_INDENT.fetch_add(0, Ordering::Relaxed);
let indent = compute_indent(indent_amount);

// Todo: Recursively ensure that *entire* string is of appropriate
Expand Down Expand Up @@ -142,7 +144,7 @@ pub mod inner {
let start_indent_amount = 2 * NUM_INDENT.fetch_add(0, Ordering::Relaxed);
let start_indent = compute_indent(start_indent_amount);

let msg_indent_amount = start_indent_amount + 2;
let msg_indent_amount = 2 * NUM_INDENT.fetch_add(0, Ordering::Relaxed) + 2;
let msg_indent = compute_indent_whitespace(msg_indent_amount);
let mut final_message = "\n".to_string();
for line in $msg().lines() {
Expand Down
Loading