mirror of
				https://github.com/ARM-software/devlib.git
				synced 2025-11-04 07:51:21 +00:00 
			
		
		
		
	Merge pull request #68 from bjackman/cpuidle-trace-all
ftrace: Poke all CPUs before collecting trace
This commit is contained in:
		@@ -46,6 +46,18 @@ cpufreq_trace_all_frequencies() {
 | 
			
		||||
	done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# CPUIdle Utility Functions
 | 
			
		||||
################################################################################
 | 
			
		||||
 | 
			
		||||
cpuidle_wake_all_cpus() {
 | 
			
		||||
	CPU_PATHS=/sys/devices/system/cpu/cpu[0-9]*
 | 
			
		||||
	MASK=0x1; for F in $CPU_PATHS; do
 | 
			
		||||
		$BUSYBOX taskset $MASK true
 | 
			
		||||
		MASK=$($BUSYBOX printf '0x%x' $((MASK * 2)))
 | 
			
		||||
	done
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
################################################################################
 | 
			
		||||
# FTrace Utility Functions
 | 
			
		||||
################################################################################
 | 
			
		||||
@@ -185,6 +197,9 @@ cpufreq_get_all_governors)
 | 
			
		||||
cpufreq_trace_all_frequencies)
 | 
			
		||||
    cpufreq_trace_all_frequencies $*
 | 
			
		||||
    ;;
 | 
			
		||||
cpuidle_wake_all_cpus)
 | 
			
		||||
    cpuidle_wake_all_cpus $*
 | 
			
		||||
    ;;
 | 
			
		||||
cgroups_get_attributes)
 | 
			
		||||
	cgroups_get_attributes $*
 | 
			
		||||
	;;
 | 
			
		||||
 
 | 
			
		||||
@@ -152,3 +152,9 @@ class Cpuidle(Module):
 | 
			
		||||
        for state in self.get_states(cpu):
 | 
			
		||||
            state.disable()
 | 
			
		||||
 | 
			
		||||
    def perturb_cpus(self):
 | 
			
		||||
        """
 | 
			
		||||
        Momentarily wake each CPU. Ensures cpu_idle events in trace file.
 | 
			
		||||
        """
 | 
			
		||||
        output = self.target._execute_util('cpuidle_wake_all_cpus')
 | 
			
		||||
        print(output)
 | 
			
		||||
 
 | 
			
		||||
@@ -170,6 +170,9 @@ class FtraceCollector(TraceCollector):
 | 
			
		||||
        if 'cpufreq' in self.target.modules:
 | 
			
		||||
            self.logger.debug('Trace CPUFreq frequencies')
 | 
			
		||||
            self.target.cpufreq.trace_frequencies()
 | 
			
		||||
        if 'cpuidle' in self.target.modules:
 | 
			
		||||
            self.logger.debug('Trace CPUIdle states')
 | 
			
		||||
            self.target.cpuidle.perturb_cpus()
 | 
			
		||||
        # Enable kernel function profiling
 | 
			
		||||
        if self.functions:
 | 
			
		||||
            self.target.execute('echo nop > {}'.format(self.current_tracer_file),
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user