Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1257092

[PATCH 02/70] cpufreq interactive governor: event tracing

From Bálint Czobor <czoborbalint@gmail.com>
Newsgroups linux.kernel
Subject [PATCH 02/70] cpufreq interactive governor: event tracing
Date 2015-10-27 19:10 +0100
Message-ID <qogR3-8u4-7@gated-at.bofh.it> (permalink)
References <qogo1-84h-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Todd Poynor <toddpoynor@google.com>

Change-Id: Ic13614a3da2faa2d4bd215ca3eb7191614f0cf66
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Bálint Czobor <czoborbalint@gmail.com>
---
 drivers/cpufreq/cpufreq_interactive.c      |   19 +++++-
 include/trace/events/cpufreq_interactive.h |   87 ++++++++++++++++++++++++++++
 2 files changed, 105 insertions(+), 1 deletion(-)
 create mode 100644 include/trace/events/cpufreq_interactive.h

diff --git a/drivers/cpufreq/cpufreq_interactive.c b/drivers/cpufreq/cpufreq_interactive.c
index 8fc147c..62e7456 100644
--- a/drivers/cpufreq/cpufreq_interactive.c
+++ b/drivers/cpufreq/cpufreq_interactive.c
@@ -30,6 +30,9 @@
 #include <linux/kthread.h>
 #include <linux/mutex.h>
 
+#define CREATE_TRACE_POINTS
+#include <trace/events/cpufreq_interactive.h>
+
 #include <asm/cputime.h>
 
 static atomic_t active_count = ATOMIC_INIT(0);
@@ -182,7 +185,11 @@ static void cpufreq_interactive_timer(unsigned long data)
 	new_freq = pcpu->freq_table[index].frequency;
 
 	if (pcpu->target_freq == new_freq)
+	{
+		trace_cpufreq_interactive_already(data, cpu_load,
+						  pcpu->target_freq, new_freq);
 		goto rearm_if_notmax;
+	}
 
 	/*
 	 * Do not scale down unless we have been at this frequency for the
@@ -190,10 +197,16 @@ static void cpufreq_interactive_timer(unsigned long data)
 	 */
 	if (new_freq < pcpu->target_freq) {
 		if (pcpu->timer_run_time - pcpu->freq_change_time
-		    < min_sample_time)
+		    < min_sample_time) {
+			trace_cpufreq_interactive_notyet(data, cpu_load,
+					 pcpu->target_freq, new_freq);
 			goto rearm;
+		}
 	}
 
+	trace_cpufreq_interactive_target(data, cpu_load, pcpu->target_freq,
+					 new_freq);
+
 	if (new_freq < pcpu->target_freq) {
 		pcpu->target_freq = new_freq;
 		spin_lock_irqsave(&down_cpumask_lock, flags);
@@ -381,6 +394,8 @@ static int cpufreq_interactive_up_task(void *data)
 			pcpu->freq_change_time_in_idle =
 				get_cpu_idle_time_us(cpu,
 						     &pcpu->freq_change_time);
+			trace_cpufreq_interactive_up(cpu, pcpu->target_freq,
+						     pcpu->policy->cur);
 		}
 	}
 
@@ -427,6 +442,8 @@ static void cpufreq_interactive_freq_down(struct work_struct *work)
 		pcpu->freq_change_time_in_idle =
 			get_cpu_idle_time_us(cpu,
 					     &pcpu->freq_change_time);
+		trace_cpufreq_interactive_down(cpu, pcpu->target_freq,
+					       pcpu->policy->cur);
 	}
 }
 
diff --git a/include/trace/events/cpufreq_interactive.h b/include/trace/events/cpufreq_interactive.h
new file mode 100644
index 0000000..3a90d3d
--- /dev/null
+++ b/include/trace/events/cpufreq_interactive.h
@@ -0,0 +1,87 @@
+#undef TRACE_SYSTEM
+#define TRACE_SYSTEM cpufreq_interactive
+
+#if !defined(_TRACE_CPUFREQ_INTERACTIVE_H) || defined(TRACE_HEADER_MULTI_READ)
+#define _TRACE_CPUFREQ_INTERACTIVE_H
+
+#include <linux/tracepoint.h>
+
+DECLARE_EVENT_CLASS(set,
+	TP_PROTO(u32 cpu_id, unsigned long targfreq,
+	         unsigned long actualfreq),
+	TP_ARGS(cpu_id, targfreq, actualfreq),
+
+	TP_STRUCT__entry(
+	    __field(          u32, cpu_id    )
+	    __field(unsigned long, targfreq   )
+	    __field(unsigned long, actualfreq )
+	   ),
+
+	TP_fast_assign(
+	    __entry->cpu_id = (u32) cpu_id;
+	    __entry->targfreq = targfreq;
+	    __entry->actualfreq = actualfreq;
+	),
+
+	TP_printk("cpu=%u targ=%lu actual=%lu",
+	      __entry->cpu_id, __entry->targfreq,
+	      __entry->actualfreq)
+);
+
+DEFINE_EVENT(set, cpufreq_interactive_up,
+	TP_PROTO(u32 cpu_id, unsigned long targfreq,
+	     unsigned long actualfreq),
+	TP_ARGS(cpu_id, targfreq, actualfreq)
+);
+
+DEFINE_EVENT(set, cpufreq_interactive_down,
+	TP_PROTO(u32 cpu_id, unsigned long targfreq,
+	     unsigned long actualfreq),
+	TP_ARGS(cpu_id, targfreq, actualfreq)
+);
+
+DECLARE_EVENT_CLASS(loadeval,
+	    TP_PROTO(unsigned long cpu_id, unsigned long load,
+		     unsigned long curfreq, unsigned long targfreq),
+	    TP_ARGS(cpu_id, load, curfreq, targfreq),
+
+	    TP_STRUCT__entry(
+		    __field(unsigned long, cpu_id    )
+		    __field(unsigned long, load      )
+		    __field(unsigned long, curfreq   )
+		    __field(unsigned long, targfreq  )
+	    ),
+
+	    TP_fast_assign(
+		    __entry->cpu_id = cpu_id;
+		    __entry->load = load;
+		    __entry->curfreq = curfreq;
+		    __entry->targfreq = targfreq;
+	    ),
+
+	    TP_printk("cpu=%lu load=%lu cur=%lu targ=%lu",
+		      __entry->cpu_id, __entry->load, __entry->curfreq,
+		      __entry->targfreq)
+);
+
+DEFINE_EVENT(loadeval, cpufreq_interactive_target,
+	    TP_PROTO(unsigned long cpu_id, unsigned long load,
+		     unsigned long curfreq, unsigned long targfreq),
+	    TP_ARGS(cpu_id, load, curfreq, targfreq)
+);
+
+DEFINE_EVENT(loadeval, cpufreq_interactive_already,
+	    TP_PROTO(unsigned long cpu_id, unsigned long load,
+		     unsigned long curfreq, unsigned long targfreq),
+	    TP_ARGS(cpu_id, load, curfreq, targfreq)
+);
+
+DEFINE_EVENT(loadeval, cpufreq_interactive_notyet,
+	    TP_PROTO(unsigned long cpu_id, unsigned long load,
+		     unsigned long curfreq, unsigned long targfreq),
+	    TP_ARGS(cpu_id, load, curfreq, targfreq)
+);
+#endif /* _TRACE_CPUFREQ_INTERACTIVE_H */
+
+/* This part must be outside protection */
+#include <trace/define_trace.h>
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 01/70] cpufreq: interactive: New 'interactive' governor Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 57/70] cpufreq: interactive: fix compiling warnings Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 56/70] cpufreq: interactive: delete timers for GOV_START Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 41/70] cpufreq: interactive: fix race on governor start/stop Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 32/70] cpufreq: interactive: specify duration of CPU speed boost pulse Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 43/70] cpufreq: interactive: add io_is_busy interface Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 39/70] cpufreq: interactive: don't handle transition notification if not enabled Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 51/70] cpufreq: interactive: resched timer if max freq raised Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 09/70] cpufreq: interactive: Separate speed target revalidate time and initial set time Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 60/70] cpufreq: interactive: hold reference on global cpufreq kobject if needed Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 24/70] cpufreq: interactive: use deferrable timer by default Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 61/70] cpufreq: interactive: restructure CPUFREQ_GOV_LIMITS Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 27/70] cpufreq: interactive: change speed according to current speed and target load Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 07/70] cpufreq: interactive: adjust code and documentation to match Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 29/70] cpufreq: interactive: allow arbitrary speed / target load mappings Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 48/70] cpufreq: interactive: reduce chance of zero time delta on load eval Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 64/70] cpufreq: interactive: prevents the frequency to directly raise above the hispeed_freq from a lower frequency. Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 65/70] cpufreq: interactive: make common_tunables static Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 69/70] cpufreq: interactive: Don't set floor_validate_time during boost Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 37/70] cpufreq: interactive: default go_hispeed_load 99%, doc updates Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 58/70] cpufreq: interactive: fix NULL pointer dereference at sysfs ops Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 66/70] cpufreq: interactive: Fix compile errors in accordance with changes from 3.14 to 3.18 Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 17/70] cpufreq: interactive: take idle notifications only when active Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 35/70] cpufreq: interactive: fix racy timer stopping Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 67/70] cpufreq: interactive: Put global cpufreq kobject on failure Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 70/70] cpufreq: interactive: Round up timer_rate to match jiffy Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 20/70] cpufreq: interactive: remove input_boost handling Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 12/70] cpufreq: interactive: Add sysfs boost interface for hints from userspace Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 22/70] cpufreq: interactive: run at fraction of hispeed_freq when load is low Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 68/70] subsystem: CPU FREQUENCY DRIVERS- Set cpu_load calculation on current frequency Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 13/70] cpufreq: interactive: set floor for boosted speed Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 55/70] cpufreq: Interactive: Implement per policy instances of governor Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 52/70] cpufreq: interactive: fix show_target_loads and show_above_hispeed_delay Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 10/70] cpufreq: interactive: Boost frequency on touchscreen input Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:40 +0100
  [PATCH 62/70] cpufreq: interactive: turn boost_pulse off on boost off Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 59/70] cpufreq: interactive: Use generic get_cpu_idle_time() from cpufreq.c Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 54/70] cpufreq: interactive: Move definition of cpufreq_gov_interactive downwards Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 53/70] cpufreq: interactive: Remove unnecessary cpu_online() check Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 25/70] cpufreq: interactive: kick timer on idle exit past expiry Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 47/70] cpufreq: interactive: handle errors from cpufreq_frequency_table_target Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 63/70] cpufreq: interactive: remove compilation error from commit 49cc72365fb7ee87762a7ccc6a32ef68627216c5 Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 44/70] cpufreq: interactive: fix crash on error paths in get_tokenized_data Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 50/70] cpufreq: interactive: fix race on cpufreq TRANSITION notifier Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 49/70] cpufreq: interactive: avoid underflow on active time calculation Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 45/70] cpufreq: interactive: base above_hispeed_delay on target freq, not current Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 46/70] cpufreq: interactive: fix uninitialized spinlock Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 18:50 +0100
  [PATCH 34/70] cpufreq: interactive: fix boosting logic Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 38/70] cpufreq: interactive: init default values at compile time Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 16/70] cpufreq: interactive: restart above_hispeed_delay at each hispeed load Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 28/70] cpufreq: interactive: apply above_hispeed_delay to each step above hispeed Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 23/70] cpufreq: interactive: pin timers to associated CPU Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 18/70] cpufreq: interactive: keep freezer happy when not current governor Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 21/70] cpufreq: interactive: always limit initial speed bump to hispeed Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 36/70] cpufreq: interactive: fix race on timer restart on governor start Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 19/70] cpufreq: interactive: handle speed up and down in the realtime task Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 42/70] cpufreq: interactive: allow arbitrary speed / delay mappings Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 26/70] cpufreq: interactive: trace actual speed in target speed decisions Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 30/70] cpufreq: interactive: remove load since last speed change Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 40/70] cpufreq: interactive: fix deadlock on spinlock in timer Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 33/70] cpufreq: interactive: add timer slack to limit idle at speed > min Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 31/70] cpufreq: interactive: adjust load for changes in speed Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:00 +0100
  [PATCH 04/70] cpufreq: interactive: set at least hispeed when above hispeed load Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:10 +0100
  [PATCH 02/70] cpufreq interactive governor: event tracing Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:10 +0100
  [PATCH 11/70] cpufreq: interactive: remove unused target_validate_time_in_idle Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:10 +0100
  [PATCH 05/70] cpufreq: interactive: don't drop speed if recently at higher load Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:10 +0100
  [PATCH 06/70] cpufreq: interactive: configurable delay before raising above hispeed Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:10 +0100
  [PATCH 08/70] cpufreq: interactive: base hispeed bump on target freq, not actual Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:10 +0100
  [PATCH 15/70] cpufreq-interactive: Compile fixup Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:10 +0100
  [PATCH 14/70] cpufreq: interactive: add boost pulse interface Bálint Czobor <czoborbalint@gmail.com> - 2015-10-27 19:10 +0100
  Re: [PATCH 01/70] cpufreq: interactive: New 'interactive' governor "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2015-10-28 01:40 +0100
    Re: [PATCH 01/70] cpufreq: interactive: New 'interactive' governor Viresh Kumar <viresh.kumar@linaro.org> - 2015-10-28 04:10 +0100
      Re: [PATCH 01/70] cpufreq: interactive: New 'interactive' governor Viresh Kumar <viresh.kumar@linaro.org> - 2015-10-29 02:50 +0100

csiph-web