Re: [PATCH 2/2] tracing/hist: add modulus operator
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2023-03-18 19:19:12
Also in:
lkml
From: Steven Rostedt <rostedt@goodmis.org>
Date: 2023-03-18 19:19:12
Also in:
lkml
On Thu, 2 Mar 2023 17:17:55 +0000 Mark Rutland [off-list ref] wrote:
@@ -436,6 +438,21 @@ static u64 hist_field_mult(struct hist_field *hist_field, return val1 * val2; } +static u64 hist_field_mod(struct hist_field *hist_field, + struct tracing_map_elt *elt, + struct trace_buffer *buffer, + struct ring_buffer_event *rbe, + void *event) +{ + struct hist_field *operand1 = hist_field->operands[0]; + struct hist_field *operand2 = hist_field->operands[1]; + + u64 val1 = hist_fn_call(operand1, elt, buffer, rbe, event); + u64 val2 = hist_fn_call(operand2, elt, buffer, rbe, event); + + return val1 % val2;
Is modulus operations on 64 bit integers valid on 32 bit architectures? Don't we need to do something like: div64_u64_rem(val1, val2, &rem); return rem; ? -- Steve
+} +