[DTrace-devel] [PATCH 1/4] Implement normalize() and denormalize()

Kris Van Hees kris.van.hees at oracle.com
Thu Jan 14 08:29:22 PST 2021


The implementation follows the legacy implementation.  One adjustment
that was needed is to retrieve the aggregation data snapshot from
dt_normalize() to ensure that we have the latest data to work on.  This
is needed due to the on-demand data retrieval that the new aggregation
implementation uses.

Tests are simplified to specifically test the functionality they are
intended for, and some tests are added to cover gaps in the testing of
normalize() and denormalize().

Signed-off-by: Kris Van Hees <kris.van.hees at oracle.com>
---
 .../aggs/err.D_NORMALIZE_AGGARG.bad.d         | 43 -------------------
 .../unittest/aggs/err.D_NORMALIZE_PROTO.bad.d | 42 ------------------
 .../aggs/err.D_NORMALIZE_SCALAR.bad.d         | 42 ------------------
 3 files changed, 127 deletions(-)
 delete mode 100644 test/unittest/aggs/err.D_NORMALIZE_AGGARG.bad.d
 delete mode 100644 test/unittest/aggs/err.D_NORMALIZE_PROTO.bad.d
 delete mode 100644 test/unittest/aggs/err.D_NORMALIZE_SCALAR.bad.d

diff --git a/test/unittest/aggs/err.D_NORMALIZE_AGGARG.bad.d b/test/unittest/aggs/err.D_NORMALIZE_AGGARG.bad.d
deleted file mode 100644
index 224bed88..00000000
--- a/test/unittest/aggs/err.D_NORMALIZE_AGGARG.bad.d
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2006, 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.
- */
-/* @@xfail: dtv2 */
-
-/*
- * ASSERTION:
- *	The first argument to normalize() should be an aggregation.
- *
- * SECTION: Aggregations/Aggregations
- *
- *
- */
-
-
-#pragma D option quiet
-#pragma D option aggrate=1ms
-#pragma D option switchrate=1ms
-
-BEGIN
-{
-	i = 0;
-	start = timestamp;
-}
-
-tick-100ms
-/i < 20/
-{
-	@func[i % 5] = sum(i * 100);
-	i++;
-}
-
-tick-100ms
-/i == 20/
-{
-
-	printf("normalized data:\n");
-	normalize(count(), 4);
-	exit(0);
-}
diff --git a/test/unittest/aggs/err.D_NORMALIZE_PROTO.bad.d b/test/unittest/aggs/err.D_NORMALIZE_PROTO.bad.d
deleted file mode 100644
index c8dc344e..00000000
--- a/test/unittest/aggs/err.D_NORMALIZE_PROTO.bad.d
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2006, 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.
- */
-/* @@xfail: dtv2 */
-
-/*
- * ASSERTION:
- *	normalize() accepts 2 args - passing fewer is an error.
- *
- * SECTION: Aggregations/Aggregations
- *
- *
- */
-
-
-#pragma D option quiet
-#pragma D option aggrate=1ms
-#pragma D option switchrate=1ms
-
-BEGIN
-{
-	i = 0;
-	start = timestamp;
-}
-
-tick-100ms
-/i < 20/
-{
-	@func[i % 5] = sum(i * 100);
-	i++;
-}
-
-tick-100ms
-/i == 20/
-{
-	printf("normalized data:\n");
-	normalize(@func);
-	exit(0);
-}
diff --git a/test/unittest/aggs/err.D_NORMALIZE_SCALAR.bad.d b/test/unittest/aggs/err.D_NORMALIZE_SCALAR.bad.d
deleted file mode 100644
index 0e14b77a..00000000
--- a/test/unittest/aggs/err.D_NORMALIZE_SCALAR.bad.d
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Oracle Linux DTrace.
- * Copyright (c) 2006, 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.
- */
-/* @@xfail: dtv2 */
-
-/*
- * ASSERTION:
- *	The second argument to normalize() should be a scalar.
- *
- * SECTION: Aggregations/Aggregations
- *
- *
- */
-
-
-#pragma D option quiet
-#pragma D option aggrate=1ms
-#pragma D option switchrate=1ms
-
-BEGIN
-{
-	i = 0;
-	start = timestamp;
-}
-
-tick-100ms
-/i < 20/
-{
-	@func[i % 5] = sum(i * 100);
-	i++;
-}
-
-tick-100ms
-/i == 20/
-{
-	printf("normalized data:\n");
-	normalize(@func, "hello");
-	exit(0);
-}
-- 
2.28.0




More information about the DTrace-devel mailing list