examples/l3fwd-power: fix busyness number
authorDavid Hunt <david.hunt@intel.com>
Mon, 15 Jul 2019 14:07:04 +0000 (15:07 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 17 Jul 2019 20:53:28 +0000 (22:53 +0200)
Current implementation only outputs 3 numbers for busyness, 0, 50 and 100.
Fix this so that the 50% is replaced by a curve, more meaningful.
This can be replaced in each use case by a suitable calculation for
that use case.

Fixes: 609e79841fcf ("examples/l3fwd-power: add telemetry mode")

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
examples/l3fwd-power/main.c

index 7a95605..cbe8f8e 100644 (file)
@@ -184,8 +184,8 @@ enum busy_rate {
  * reference CYCLES to be used to
  * measure core busyness based on poll count
  */
-#define MIN_CYCLES 1500000ULL
-#define MAX_CYCLES 2500000ULL
+#define MIN_CYCLES  1500000ULL
+#define MAX_CYCLES 22000000ULL
 
 /* (500ms) */
 #define TELEMETRY_INTERVALS_PER_SEC 2
@@ -1034,7 +1034,7 @@ main_telemetry_loop(__attribute__((unused)) void *dummy)
                                br = FULL;
                        } else if (diff_tsc > MIN_CYCLES &&
                                        diff_tsc < MAX_CYCLES) {
-                               br = PARTIAL;
+                               br = (diff_tsc * 100) / MAX_CYCLES;
                        } else {
                                br = ZERO;
                        }