lkml.org 
[lkml]   [2012]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 05/13] HW-latency: Add CPU field in sample output
Date
The filed tells user the sample is from which cpu.

Signed-off-by: Luming Yu <luming.yu@intel.com>
---
drivers/misc/hw_latency_test.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/hw_latency_test.c b/drivers/misc/hw_latency_test.c
index 4303644..256b1c0 100644
--- a/drivers/misc/hw_latency_test.c
+++ b/drivers/misc/hw_latency_test.c
@@ -124,11 +124,13 @@ static struct sample *buffer_get_sample(struct sample *sample)
static int buffer_add_sample(u64 sample)
{
int ret = 0;
+ unsigned int cpu = smp_processor_id();

if (sample > data.threshold) {
struct sample s;

data.count++;
+ s.cpu = cpu;
s.seqnum = data.count;
s.duration = sample;
s.timestamp = CURRENT_TIME;
@@ -615,7 +617,8 @@ static ssize_t debug_sample_fread(struct file *filp, char __user *ubuf,
goto out;
}
}
- len = snprintf(buf, sizeof(buf), "%010lu.%010lu\t%llu\n",
+ len = snprintf(buf, sizeof(buf), "[%d]%010lu.%010lu\t%llu\n",
+ sample->cpu,
sample->timestamp.tv_sec,
sample->timestamp.tv_nsec,
sample->duration);
--
1.7.12.1


\
 
 \ /
  Last update: 2012-11-04 14:42    [W:0.107 / U:0.168 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site