-
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.
Add code for llquantize() aggregation function
The value is converted to a bin number with manually written BPF code, in function dt_cg_agg_llquantize_bin(), rather than with C code that is pre-compiled to BPF. The reason is that the bin computation depends on a number of parameters (factor, lmag, hmag, steps) and combinations thereof. Those combinations are a lot of run-time computations, and the BPF code would put additional, combinatorially growing load on the BPF verifier -- e.g., for quantities like powl(factor, lmag). Meanwhile, these parameters are actually known at code-generation time. So, we can do a lot of the computations at code-generation time and just load final values into BPF registers, saving a lot of run-time computation. In contrast, the C-to-BPF pre-compiled code would impose an undue burden on the verifier because it needs to be generic code that needs to compute these values that can be computed at script compile time. The llquantize function is rather complex. There is a big block of comments to explain what we're trying to achieve. Signed-off-by: Eugene Loh <eugene.loh@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
Showing
3 changed files
with
248 additions
and
3 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
20 changes: 20 additions & 0 deletions
20
test/unittest/aggs/err.D_LLQUANT_STEPVAL.llqdividefactor.d
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,20 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: | ||
* llquantize() steps must divide factor when steps<factor | ||
* | ||
* SECTION: Aggregations/Aggregations | ||
* | ||
*/ | ||
|
||
|
||
BEGIN | ||
{ | ||
@ = llquantize(1234, 10, 0, 6, 3); | ||
} |
20 changes: 20 additions & 0 deletions
20
test/unittest/aggs/err.D_LLQUANT_STEPVAL.llqmultiplefactor.d
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,20 @@ | ||
/* | ||
* Oracle Linux DTrace. | ||
* Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. | ||
* Licensed under the Universal Permissive License v 1.0 as shown at | ||
* http://oss.oracle.com/licenses/upl. | ||
*/ | ||
|
||
/* | ||
* ASSERTION: | ||
* llquantize() steps must be a multiple of factor when steps>factor | ||
* | ||
* SECTION: Aggregations/Aggregations | ||
* | ||
*/ | ||
|
||
|
||
BEGIN | ||
{ | ||
@ = llquantize(1234, 10, 0, 6, 15); | ||
} |