-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First, quantize the value into a 0-based bin number. As was done for quantize(), use C code in the bpf/ subdirectory to be cross-compiled into BPF when DTrace is built. Then, the "implementation" function -- which needs to run twice, once per aggregation copy -- is simply dt_cg_agg_quantize_impl(). That is, we reuse the same function for lquantize() that was originally introduced for quantize(). Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
4 changed files
with
44 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
*/ | ||
#include <linux/bpf.h> | ||
#include <stdint.h> | ||
#include <bpf-helpers.h> | ||
|
||
#ifndef noinline | ||
# define noinline __attribute__((noinline)) | ||
#endif | ||
|
||
noinline uint64_t dt_agg_lqbin(int64_t val, int32_t base, uint64_t levels, | ||
uint64_t step) | ||
{ | ||
uint64_t level; | ||
|
||
if (step == 0 || val < base) | ||
return 0; | ||
level = (val - base) / step; | ||
if (level > levels) | ||
level = levels; | ||
return level + 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters