[v1] examples/power: fix busyness number limed to 50%

Message ID 20190715140704.27221-1-david.hunt@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series [v1] examples/power: fix busyness number limed to 50% |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS

Commit Message

Hunt, David July 15, 2019, 2:07 p.m. UTC
  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>
---
 examples/l3fwd-power/main.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
  

Comments

Burakov, Anatoly July 16, 2019, 1:50 p.m. UTC | #1
On 15-Jul-19 3:07 PM, David Hunt wrote:
> 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>
  
Thomas Monjalon July 17, 2019, 8:49 p.m. UTC | #2
16/07/2019 15:50, Burakov, Anatoly:
> On 15-Jul-19 3:07 PM, David Hunt wrote:
> > 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>

Applied, thanks
  

Patch

diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c
index 7a95605c4..cbe8f8e3f 100644
--- a/examples/l3fwd-power/main.c
+++ b/examples/l3fwd-power/main.c
@@ -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;
 			}