Skip to content

feat: track atomic memory access size#116

Open
mariaxarisi wants to merge 3 commits into
open-s4c:mainfrom
mariaxarisi:issue49
Open

feat: track atomic memory access size#116
mariaxarisi wants to merge 3 commits into
open-s4c:mainfrom
mariaxarisi:issue49

Conversation

@mariaxarisi

Copy link
Copy Markdown
Contributor

This PR introduces the ability to trace the memory access size for atomic operations.

What Changed:

  • Added logic to record the byte size of atomic read and write operations.
  • Added the coldtrace_atomic_access_entry structure to correctly save the size data.
  • Testing: Added a new test (trace_aread_awrite_size) to verify that atomic sizes are captured correctly.

Related Issue:

Introduces a new `coldtrace_atomic_access_entry` struct to record the
exact byte size of atomic reads and writes in the binary trace files.

- Extends atomic read/write trace entries from 16 to 24 bytes to include `size`.
- Modifies TSan subscriber macros in `subs_tsan.c` to extract and serialize the size parameter.
- Updates the `trace_dump.py` tool to correctly unpack the new 24-byte format and print the access size.

Signed-off-by: mariaxarisi <maria.charisi@huawei.com>
Signed-off-by: mariaxarisi <maria.charisi@huawei.com>
Signed-off-by: mariaxarisi <maria.charisi@huawei.com>

@ggeier ggeier left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please check the value placeholders comment, besides that, great addition!


EXPECT_SOME(COLDTRACE_WRITE, 0, 1),
EXPECT_SOME(COLDTRACE_READ, 0, 1),
EXPECT_VALUE_SIZE(COLDTRACE_ATOMIC_WRITE, 5, sizeof(float)),

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you're using 0..3 and 5..6, why?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just chose one number for each atomic variable, 0-3 for uint, 5 for float and 6 for double. Those values are just placeholders, right?

@ggeier ggeier requested a review from db7 June 19, 2026 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

add size for atomic reads and write to trace

2 participants