[Bug tapsets/31740] New: @hist_log affects the result of @variance

lijunlong at openresty dot com sourceware-bugzilla@sourceware.org
Wed May 15 07:10:33 GMT 2024


https://sourceware.org/bugzilla/show_bug.cgi?id=31740

            Bug ID: 31740
           Summary: @hist_log affects the result of @variance
           Product: systemtap
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: tapsets
          Assignee: systemtap at sourceware dot org
          Reporter: lijunlong at openresty dot com
  Target Milestone: ---

Description:
I discovered that using `@hist_log` impacts the result of `@variance` in
SystemTap. Here's a minimal reproducer script:

``` test.stp
global stats;

probe oneshot {
    stats["k0"] <<< 1;
    stats["k0"] <<< 2;
    stats["k0"] <<< 3;
    foreach ([k] in stats) {
        printf("variance = %d\n", @variance(stats[k], 7));
        // print(@hist_log(stats[k]));
    }
    abort();
}
```

When I execute the script directly, the output shows `variance = 1`:

```
systemtap git:(master) ✗ /usr/local/bin/stap test.stp
variance = 1
```

However, if I uncomment the line with `@hist_log`, the variance changes to 0:

```
/usr/local/bin/stap test.stp
/tmp/stapEw5Hgt/stap_2d4787b763a02566bed18cc9de9268e2_1566_src.o: warning:
objtool: _stp_vsprint_memory+0x344: call to __get_user_nocheck_1() with UACCESS
enabled
variance = 0
value |-------------------------------------------------- count
    0 |                                                   0
    1 |@                                                  1
    2 |@@                                                 2
    4 |                                                   0
    8 |                                                   0
```

This behavior suggests that there might be an issue with how `@hist_log`
interacts with `@variance`. The presence of `@hist_log` seems to affect the
calculated variance value.

Could you please investigate this issue and provide any insights or fixes? Let
me know if you need any additional information.

Thank you!

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Systemtap mailing list