On Tue, Mar 10, 2015 at 12:58 PM, Koan-Sin Tan <freedom.tan(a)linaro.org> wrote:
> There was no manual page. To make users who do not compile
> idlestat from source code, it's more convenient to have
> man page for idlestat.
>
> Add install: in Makefile for installing idlestat and idlestat to
> /usr/local/bin and /usr/local/man/man1 respectively.
>
> Signed-off-by: Koan-Sin Tan <freedom.tan(a)linaro.org>
> ---
> idlestat.1 | 276 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Missed the changes to the makefile when generating the patch?
> 1 file changed, 276 insertions(+)
> create mode 100644 idlestat.1
>
> diff --git a/idlestat.1 b/idlestat.1
> new file mode 100644
> index 0000000..25d2f47
> --- /dev/null
> +++ b/idlestat.1
> @@ -0,0 +1,276 @@
> +.TH idlestat 1 "2015-01-10" "0.1" "idlestat utils"
> +.SH NAME
> +idlestat \- A CPU power-state analysis tool.
> +.SH SYNOPSIS
> +.\" The general command line
> +Trace mode:
> +.IP
> +.B idlestat
> +--trace -f|--trace-file \fIfilename\fR -t|--duration \fIseconds\fR [\fIOPTION\fR] [command]
> +.P
> +Reporting mode:
> +.IP
> +.B idlestat
> +--import -f|--trace-file \fIfilename\fR [\fIOPTION\fR]
> +.SH DESCRIPTION
> +\fBIdlestat\fR comes with two modes: in \fBtrace mode\fR, it measures how long the CPUs have been in the different idle and operating states, analyzes captured events, logs them, and generates a report; in \fBreporting mode\fR, it reads the trace file, analyzes logged events in the trace file, and generates a report. A report by idlestat shows statistics of power related states. Currently, it handles P-states, C-states, and IRQ states.
> +
> +For trace mode, \fBidlestat\fR relies on the kernel's FTRACE function to monitor and capture C-state and P-state transitions of CPUs over a time interval. That is, for trace mode, idlestat needs a kernel with FTRACE related configurations enabled. And since it uses FTRACE, root privilege is needed when running in trace mode. Idlestat extracts the following information from trace file:
> +.IP "" 2
> +Times when CPUs entered and exited a certain C-state
> +.IP "" 2
> +Times when CPUs entered and exited a certain P-state
> +.IP "" 2
> +Raised IRQs
> +.LP
> +Following a successful run, idlestat calculates and reports the following
> +information:
> +.IP - 2
> +Total, average, minimum, and maximum time spent in each C-state, per-CPU.
> +.IP - 2
> +Total, average, minimum, and maximum time spent in each P-state, per-CPU.
> +.IP - 2
> +Total, average, minimum, and maximum time during which all CPUs in a cluster
> +were in a "shallowest" (closest to running) state of all the constituent
> +CPUs.
> +.IP - 2
> +Number of times a certain IRQ caused a CPU to exit idle state, per-CPU and per-IRQ
> +
> +.SH OPTIONS
> +.TP
> +\fB\-\-trace\fR
> +Run idlestat in trace mode, as noted above, root privilege is needed. Used with \fB\-t\fR and \fB\-f\fR to specify running duration and trace output filename, respectively.
> +
> +.TP
> +\fB\-\-import\fR
> +Run idlestat in reporting mode. Used with \fB\-f\fR to specify the trace file to import.
> +
> +.TP
> +\fB\-f\fR, \fB\-\-trace-file\fR \fIfilename\fR
> +Specify the trace filename to generate (for \fB\-\-trace\fR) or read (for \fB\-\-import\fR).
> +
> +.TP
> +\fB\-t\fR, \fB\-\-duration\fR \fIseconds\fR
> +Time to capture in seconds
> +
> +.TP
> +\fB[command]\fR
> +If the command argument is given, idlestat will fork a child to run the command so that you can capture related states when the command is running. Note that if the running command does not terminate before the time specified by \fB\-t\fR, idlestat will send a SIGTERM to the child process to ask it to terminate. If the command to run lasts less than the time specified by \fB\-t\fR, idlestat will terminate after the command finished.
> +
> +When there is no command, idlestat does trace capture and other works dutifully.
> +
> +.TP
> +\fB\-b\fR, \fB\-\-baseline_trace\fR \fIbaseline_filename\fR
> +Specify baseline filename for trace comparison. See \fBCOMPARISON\fR and \fBEXAMPLES\fR for more information.
> +
> +.TP
> +\fB\-c\fR, \fB\-\-idle\fR
> +Show idle, C-state in ACPI term, statistics. This is the default mode if neither \fB\-w\fR nor \fB\-p\fR is set. Note that \fB\-w\fR, \fB\-c\fR, and \fB\-p\fR are not exclusive, that is, you can choose any combination of the three.
> +
> +.TP
> +\fB\-e\fR, \fB\-\-energy-model-file\fR \fIenergy_model\fR
> +Specify energy model file. See \fBENERGY MODEL\fR
> +for the description of the energy file format.
> +
> +.TP
> +\fB\-h\fR, \fB\-\-help\fR, \fB\-?\fR
> +Print simple help messages.
> +
> +.TP
> +\fB\-o\fR, \fB\-\-output-file\fR \fIfilename\fR
> +Specify the file name to output statistics. If not specified, statistics
> +are printed to stdout.
> +
> +.TP
> +\fB\-p\fR, \fB\-\-frequency\fR
> +Show cpufreq (or say P-state) statistics.
> +
> +.TP
> +\fB\-r\fR, \fB\-\-report-format\fR
> +Specify the report format. Valid types are: default, boxless, csv, and
> +comparison.
> +
> +.TP
> +\fB\-v\fR, \fB\-\-verbose\fR
> +Specify the verbosity level. This option could be specified multiple times. Each copy of the option increases verbosity level by one, currently the highest verbosity level used for any message is 2.
> +
> +.TP
> +\fB\-w\fR, \fB\-\-wakeup\fR
> +Show wakeup statistics.
> +
> +.TP
> +\fB\-B\fR, \fB\-\-boxless\fR
> +Set the report format to boxless
> +
> +.TP
> +\fB\-C\fR, \fB\-\-csv\fR
> +Set the report format to comma separated values (CSV)
> +
> +.TP
> +\fB\-I, \fB\-\-poll\-interval\fR
> +Set kernel polling interval, which is used to determine if it’s time move data from kernel FTRACE buffer to other places.
> +
> +.TP
> +\fB\-S, \fB\-\-buffer\-size\fR
> +Set the kernel FTRACE buffer size to use.
> +
> +.TP
> +\fB\-V\fR, \fB\-\-version\fR
> +Show idlestat version information and exit.
> +
> +.SH COMPARISON
> +The comparison report is used to compare changes between the active trace (specified by \fB\-f\fR,\fB\-\-trace\-file\fR) and the baseline trace. It becomes active by providing a baseline trace (\fB-b\fR,\fB\-\-baseline_trace\fR) and specifying the comparison report style with "\fB\-r\fR comparison".
> +
> +.SH ENERGY MODEL
> +The following describes the format of idlestat energy model files
> +(using the included energy_model file as an example):
> +
> +Lines starting with # or which are blank are ignored.
> +
> +First, specify how many clusters there are.
> +
> +.nf
> +clusters 1
> +.fi
> +
> +For each cluster (named clusterA, clusterB, etc.) specify
> +how many cap states and C states there are. Idlestat will check
> +that the correct number of clusters are provided.
> +
> +.nf
> +#
> +clusterA: 16 cap states 5 C states
> +.fi
> +
> +Then specify the name, cluster power and core power for each P-state
> +(idlestat will check if there are the correct number of P-states provided)
> +in the cluster.
> +.nf
> +
> +P-states:
> +# speed, cluster power, core power
> +2901 6200 3200
> +2900 6190 3190
> +2800 6180 3180
> +2700 6170 3170
> +2500 6160 3160
> +2400 6150 3150
> +2300 6140 3140
> +2200 6130 3130
> +2000 6120 3120
> +1900 6110 3110
> +1800 6100 3100
> +1700 6090 3090
> +1600 6080 3080
> +1400 6070 3070
> +1300 6060 3060
> +1200 6050 3050
> +
> +.fi
> +Then specify the name, cluster power and core power for each C-state
> +(idlestat will check if there are the correct number of C-states provided)
> +in the cluster.
> +
> +.nf
> +
> +C-states:
> +C1-IVB 25 0
> +C1E-IVB 30 0
> +C3-IVB 35 0
> +C6-IVB 40 0
> +C7-IVB 35 0
> +
> +.fi
> +
> +Finally, specify the wakeup power.
> +
> +wakeup 210 6
> +
> +Repeat for each cluster.
> +
> +.SH TRACE FILE FORMAT
> +
> +Idlestat has its own trace file format, which is based on ftrace's format (see Documentation/trace/ftrace.txt in kernel source). Besides standard FTRACE entries, idlestat adds CPU topology, C-state information, and some artificial P-State entries. Idlestat can also import standard FTRACE format and "trace-cmd report" format. Note that since there is no CPU topology and C-state information in FTRACE or trace-cmd trace files, they should be used on the machines those traces are captured.
> +
> +.SH REPORT FORMATS
> +Currently, idlestat supports four report formats: default, boxless, csv, and comparison.
> +.IP 1. 4
> +default: show C-state, P-State, and IRQ state statistics tables if corresponding -c, -p, and -w command line options are set. Tables come with - and | as boundaries.
> +.IP 2. 4
> +boxless: it's the default without - and | as table boundaries. This is more Braille terminal
> +friendly than the default one
> +.IP 3. 4
> +csv: comma separated values. This is easier to process with scripting languages, such as
> +awk and perl. Also it's easier to be processed with spreadsheet software.
> +.IP 4. 4
> +comparison: This is similar to default report style, except that it displays changes
> +in active trace compared to the baseline trace. It becomes active by providing a
> +baseline trace (--baseline) and specifying the comparison report style with
> +"-r comparison".
> +.SH EXAMPLES
> +Assuming the idlestat binary is in your PATH.
> +.IP 1. 4
> +Run a trace, post-process the results (default is to show only C-state statistics):
> +.RS 8
> +sudo idlestat --trace -f /tmp/mytrace -t 10
> +.RE
> +.IP 2. 4
> +Run a trace, post-process the results and print all statistics:
> +.RS 8
> +sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w
> +.RE
> +.IP 3. 4
> +Run a trace with an external workload, post-process the results:
> +.RS 8
> +sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -- rt-app /tmp/mp3.json
> +.RE
> +.IP 4. 4
> +Post-process a trace captured earlier:
> +.RS 8
> +idlestat --import -f /tmp/mytrace
> +.RE
> +.IP 5. 4
> +Run a trace, post-process the results and print all statistics into a file:
> +.RS 8
> +sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -o /tmp/myreport
> +.RE
> +.IP 6. 4
> +Run a comparison trace, say, before and after making changes to system behavior
> +.RS 8
> +sudo idlestat --trace -f /tmp/baseline -t 10
> +.br
> +sudo idlestat --trace -f /tmp/changedstate -t 10
> +.br
> +idlestat --import -f /tmp/changedstate -b /tmp/baseline -r comparison
> +.RE
> +.SH LIMITATIONS
> +During the acquisition, idlestat tries to stay quiescent to prevent disturbing the traces. For this reason the traces are buffered in a fixed buffer size. If the duration of the acquisition produces more traces than what the buffer is capable to store, that will result in a truncated result.
> +.SH AUTHOR
> +Started by
> +.MT daniel.lezcano(a)linaro.org
> +Daniel Lezcano
> +.ME
> +with contributions from others.
> +See the git log of the source code (https://git.linaro.org/power/idlestat.git) for all the contributors.
> +.SH REPORTING BUGS
> +Send mail to
> +.MT sched-tools(a)linaro.org
> +.ME .
> +Or, submit bugs at
> +.UR https://bugs.linaro.org/enter_bug.cgi
> +.UE
> +under Product "power management", Component "idlestat".
> +
> +.SH COPYRIGHT
> +Copyright \(co 2015, Linaro Limited.
> +License GPLv2: GNU GPL version 2
> +.UR http://gnu.org/licenses/gpl.html
> +.UE .
> +
> +This is free software: you are free to change and redistribute it.
> +There is NO WARRANTY, to the extent permitted by law.
> +Or, say, there is NO warranty; not even for MERCHANTABILITY
> +or FITNESS FOR A PARTICULAR PURPOSE.
> +
> +.SH SEE ALSO
> +trace-cmd(1), trace-cmd-format(1), trace-cmd.dat(5)
> --
> 1.9.1
>
On Wed, Jan 28, 2015 at 7:58 PM, Tuukka Tikkanen <idlestat(a)tic0.net> wrote:
> Previously any directory entry in /sys/devices/system/cpu/ with
> the substring "cpu" within the name would be considered to be
> a subdirectory for a cpu. The substring should begin the name,
> not just appear within the name.
OK. Will apply.
But what directories do you see other than cpuX, cpuidle and cpufreq
under /sys/devices/system/cpu/ ?
cpuidle and cpufreq are already filtered in the previous line. I'm
curious what else are you guarding against?
> Signed-off-by: Tuukka Tikkanen <idlestat(a)tic0.net>
> ---
> topology.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/topology.c b/topology.c
> index ff0b6fb..c7528af 100644
> --- a/topology.c
> +++ b/topology.c
> @@ -333,7 +333,7 @@ static struct cpu_topology *topo_folder_scan(char *path, folder_filter_t filter)
> if (filter && filter(direntp->d_name))
> continue;
>
> - if (!strstr(direntp->d_name, "cpu"))
> + if (strncmp(direntp->d_name, "cpu", 3))
> continue;
>
> ret = asprintf(&newpath, "%s/%s/%s", basedir,
> --
> 1.7.9.5
>
Freedom,
I think we should do a Makefile "install" target to install this man
page in the right location. And while we're at it, the "install" target
should copy the idlestat binary to /usr/local/bin too.
Can you resend with these changes?
Regards,
Amit
On Tue, 17 Feb 2015 at 16:24 +0530, Koan-Sin Tan <freedom.tan(a)linaro.org> wrote:
> Signed-off-by: Koan-Sin Tan <freedom.tan(a)linaro.org>
> ---
> idlestat.1 | 276 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 1 file changed, 276 insertions(+)
> create mode 100644 idlestat.1
>
> diff --git a/idlestat.1 b/idlestat.1
> new file mode 100644
> index 0000000..25d2f47
> --- /dev/null
> +++ b/idlestat.1
> @@ -0,0 +1,276 @@
> +.TH idlestat 1 "2015-01-10" "0.1" "idlestat utils"
> +.SH NAME
> +idlestat \- A CPU power-state analysis tool.
> +.SH SYNOPSIS
> +.\" The general command line
> +Trace mode:
> +.IP
> +.B idlestat
> +--trace -f|--trace-file \fIfilename\fR -t|--duration \fIseconds\fR [\fIOPTION\fR] [command]
> +.P
> +Reporting mode:
> +.IP
> +.B idlestat
> +--import -f|--trace-file \fIfilename\fR [\fIOPTION\fR]
> +.SH DESCRIPTION
> +\fBIdlestat\fR comes with two modes: in \fBtrace mode\fR, it measures how long the CPUs have been in the different idle and operating states, analyzes captured events, logs them, and generates a report; in \fBreporting mode\fR, it reads the trace file, analyzes logged events in the trace file, and generates a report. A report by idlestat shows statistics of power related states. Currently, it handles P-states, C-states, and IRQ states.
> +
> +For trace mode, \fBidlestat\fR relies on the kernel's FTRACE function to monitor and capture C-state and P-state transitions of CPUs over a time interval. That is, for trace mode, idlestat needs a kernel with FTRACE related configurations enabled. And since it uses FTRACE, root privilege is needed when running in trace mode. Idlestat extracts the following information from trace file:
> +.IP "" 2
> +Times when CPUs entered and exited a certain C-state
> +.IP "" 2
> +Times when CPUs entered and exited a certain P-state
> +.IP "" 2
> +Raised IRQs
> +.LP
> +Following a successful run, idlestat calculates and reports the following
> +information:
> +.IP - 2
> +Total, average, minimum, and maximum time spent in each C-state, per-CPU.
> +.IP - 2
> +Total, average, minimum, and maximum time spent in each P-state, per-CPU.
> +.IP - 2
> +Total, average, minimum, and maximum time during which all CPUs in a cluster
> +were in a "shallowest" (closest to running) state of all the constituent
> +CPUs.
> +.IP - 2
> +Number of times a certain IRQ caused a CPU to exit idle state, per-CPU and per-IRQ
> +
> +.SH OPTIONS
> +.TP
> +\fB\-\-trace\fR
> +Run idlestat in trace mode, as noted above, root privilege is needed. Used with \fB\-t\fR and \fB\-f\fR to specify running duration and trace output filename, respectively.
> +
> +.TP
> +\fB\-\-import\fR
> +Run idlestat in reporting mode. Used with \fB\-f\fR to specify the trace file to import.
> +
> +.TP
> +\fB\-f\fR, \fB\-\-trace-file\fR \fIfilename\fR
> +Specify the trace filename to generate (for \fB\-\-trace\fR) or read (for \fB\-\-import\fR).
> +
> +.TP
> +\fB\-t\fR, \fB\-\-duration\fR \fIseconds\fR
> +Time to capture in seconds
> +
> +.TP
> +\fB[command]\fR
> +If the command argument is given, idlestat will fork a child to run the command so that you can capture related states when the command is running. Note that if the running command does not terminate before the time specified by \fB\-t\fR, idlestat will send a SIGTERM to the child process to ask it to terminate. If the command to run lasts less than the time specified by \fB\-t\fR, idlestat will terminate after the command finished.
> +
> +When there is no command, idlestat does trace capture and other works dutifully.
> +
> +.TP
> +\fB\-b\fR, \fB\-\-baseline_trace\fR \fIbaseline_filename\fR
> +Specify baseline filename for trace comparison. See \fBCOMPARISON\fR and \fBEXAMPLES\fR for more information.
> +
> +.TP
> +\fB\-c\fR, \fB\-\-idle\fR
> +Show idle, C-state in ACPI term, statistics. This is the default mode if neither \fB\-w\fR nor \fB\-p\fR is set. Note that \fB\-w\fR, \fB\-c\fR, and \fB\-p\fR are not exclusive, that is, you can choose any combination of the three.
> +
> +.TP
> +\fB\-e\fR, \fB\-\-energy-model-file\fR \fIenergy_model\fR
> +Specify energy model file. See \fBENERGY MODEL\fR
> +for the description of the energy file format.
> +
> +.TP
> +\fB\-h\fR, \fB\-\-help\fR, \fB\-?\fR
> +Print simple help messages.
> +
> +.TP
> +\fB\-o\fR, \fB\-\-output-file\fR \fIfilename\fR
> +Specify the file name to output statistics. If not specified, statistics
> +are printed to stdout.
> +
> +.TP
> +\fB\-p\fR, \fB\-\-frequency\fR
> +Show cpufreq (or say P-state) statistics.
> +
> +.TP
> +\fB\-r\fR, \fB\-\-report-format\fR
> +Specify the report format. Valid types are: default, boxless, csv, and
> +comparison.
> +
> +.TP
> +\fB\-v\fR, \fB\-\-verbose\fR
> +Specify the verbosity level. This option could be specified multiple times. Each copy of the option increases verbosity level by one, currently the highest verbosity level used for any message is 2.
> +
> +.TP
> +\fB\-w\fR, \fB\-\-wakeup\fR
> +Show wakeup statistics.
> +
> +.TP
> +\fB\-B\fR, \fB\-\-boxless\fR
> +Set the report format to boxless
> +
> +.TP
> +\fB\-C\fR, \fB\-\-csv\fR
> +Set the report format to comma separated values (CSV)
> +
> +.TP
> +\fB\-I, \fB\-\-poll\-interval\fR
> +Set kernel polling interval, which is used to determine if it’s time move data from kernel FTRACE buffer to other places.
> +
> +.TP
> +\fB\-S, \fB\-\-buffer\-size\fR
> +Set the kernel FTRACE buffer size to use.
> +
> +.TP
> +\fB\-V\fR, \fB\-\-version\fR
> +Show idlestat version information and exit.
> +
> +.SH COMPARISON
> +The comparison report is used to compare changes between the active trace (specified by \fB\-f\fR,\fB\-\-trace\-file\fR) and the baseline trace. It becomes active by providing a baseline trace (\fB-b\fR,\fB\-\-baseline_trace\fR) and specifying the comparison report style with "\fB\-r\fR comparison".
> +
> +.SH ENERGY MODEL
> +The following describes the format of idlestat energy model files
> +(using the included energy_model file as an example):
> +
> +Lines starting with # or which are blank are ignored.
> +
> +First, specify how many clusters there are.
> +
> +.nf
> +clusters 1
> +.fi
> +
> +For each cluster (named clusterA, clusterB, etc.) specify
> +how many cap states and C states there are. Idlestat will check
> +that the correct number of clusters are provided.
> +
> +.nf
> +#
> +clusterA: 16 cap states 5 C states
> +.fi
> +
> +Then specify the name, cluster power and core power for each P-state
> +(idlestat will check if there are the correct number of P-states provided)
> +in the cluster.
> +.nf
> +
> +P-states:
> +# speed, cluster power, core power
> +2901 6200 3200
> +2900 6190 3190
> +2800 6180 3180
> +2700 6170 3170
> +2500 6160 3160
> +2400 6150 3150
> +2300 6140 3140
> +2200 6130 3130
> +2000 6120 3120
> +1900 6110 3110
> +1800 6100 3100
> +1700 6090 3090
> +1600 6080 3080
> +1400 6070 3070
> +1300 6060 3060
> +1200 6050 3050
> +
> +.fi
> +Then specify the name, cluster power and core power for each C-state
> +(idlestat will check if there are the correct number of C-states provided)
> +in the cluster.
> +
> +.nf
> +
> +C-states:
> +C1-IVB 25 0
> +C1E-IVB 30 0
> +C3-IVB 35 0
> +C6-IVB 40 0
> +C7-IVB 35 0
> +
> +.fi
> +
> +Finally, specify the wakeup power.
> +
> +wakeup 210 6
> +
> +Repeat for each cluster.
> +
> +.SH TRACE FILE FORMAT
> +
> +Idlestat has its own trace file format, which is based on ftrace's format (see Documentation/trace/ftrace.txt in kernel source). Besides standard FTRACE entries, idlestat adds CPU topology, C-state information, and some artificial P-State entries. Idlestat can also import standard FTRACE format and "trace-cmd report" format. Note that since there is no CPU topology and C-state information in FTRACE or trace-cmd trace files, they should be used on the machines those traces are captured.
> +
> +.SH REPORT FORMATS
> +Currently, idlestat supports four report formats: default, boxless, csv, and comparison.
> +.IP 1. 4
> +default: show C-state, P-State, and IRQ state statistics tables if corresponding -c, -p, and -w command line options are set. Tables come with - and | as boundaries.
> +.IP 2. 4
> +boxless: it's the default without - and | as table boundaries. This is more Braille terminal
> +friendly than the default one
> +.IP 3. 4
> +csv: comma separated values. This is easier to process with scripting languages, such as
> +awk and perl. Also it's easier to be processed with spreadsheet software.
> +.IP 4. 4
> +comparison: This is similar to default report style, except that it displays changes
> +in active trace compared to the baseline trace. It becomes active by providing a
> +baseline trace (--baseline) and specifying the comparison report style with
> +"-r comparison".
> +.SH EXAMPLES
> +Assuming the idlestat binary is in your PATH.
> +.IP 1. 4
> +Run a trace, post-process the results (default is to show only C-state statistics):
> +.RS 8
> +sudo idlestat --trace -f /tmp/mytrace -t 10
> +.RE
> +.IP 2. 4
> +Run a trace, post-process the results and print all statistics:
> +.RS 8
> +sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w
> +.RE
> +.IP 3. 4
> +Run a trace with an external workload, post-process the results:
> +.RS 8
> +sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -- rt-app /tmp/mp3.json
> +.RE
> +.IP 4. 4
> +Post-process a trace captured earlier:
> +.RS 8
> +idlestat --import -f /tmp/mytrace
> +.RE
> +.IP 5. 4
> +Run a trace, post-process the results and print all statistics into a file:
> +.RS 8
> +sudo idlestat --trace -f /tmp/mytrace -t 10 -p -c -w -o /tmp/myreport
> +.RE
> +.IP 6. 4
> +Run a comparison trace, say, before and after making changes to system behavior
> +.RS 8
> +sudo idlestat --trace -f /tmp/baseline -t 10
> +.br
> +sudo idlestat --trace -f /tmp/changedstate -t 10
> +.br
> +idlestat --import -f /tmp/changedstate -b /tmp/baseline -r comparison
> +.RE
> +.SH LIMITATIONS
> +During the acquisition, idlestat tries to stay quiescent to prevent disturbing the traces. For this reason the traces are buffered in a fixed buffer size. If the duration of the acquisition produces more traces than what the buffer is capable to store, that will result in a truncated result.
> +.SH AUTHOR
> +Started by
> +.MT daniel.lezcano(a)linaro.org
> +Daniel Lezcano
> +.ME
> +with contributions from others.
> +See the git log of the source code (https://git.linaro.org/power/idlestat.git) for all the contributors.
> +.SH REPORTING BUGS
> +Send mail to
> +.MT sched-tools(a)linaro.org
> +.ME .
> +Or, submit bugs at
> +.UR https://bugs.linaro.org/enter_bug.cgi
> +.UE
> +under Product "power management", Component "idlestat".
> +
> +.SH COPYRIGHT
> +Copyright \(co 2015, Linaro Limited.
> +License GPLv2: GNU GPL version 2
> +.UR http://gnu.org/licenses/gpl.html
> +.UE .
> +
> +This is free software: you are free to change and redistribute it.
> +There is NO WARRANTY, to the extent permitted by law.
> +Or, say, there is NO warranty; not even for MERCHANTABILITY
> +or FITNESS FOR A PARTICULAR PURPOSE.
> +
> +.SH SEE ALSO
> +trace-cmd(1), trace-cmd-format(1), trace-cmd.dat(5)
> --
> 1.9.1
The start time of a timer is currently set to the beg of the use case which
generates issue if the timer starts to be used quite late in use case.
Change the init sequence so the start time of the timer is initialized the
1st time it is used
Signed-off-by: Vincent Guittot <vincent.guittot(a)linaro.org>
---
src/rt-app.c | 12 ++++++------
src/rt-app_parse_config.c | 2 +-
src/rt-app_types.h | 1 +
3 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/rt-app.c b/src/rt-app.c
index 3cd601d..d2945e1 100644
--- a/src/rt-app.c
+++ b/src/rt-app.c
@@ -174,6 +174,12 @@ static int run_event(event_data_t *event, int dry_run,
log_debug("timer %d ", event->duration);
t_period = usec_to_timespec(event->duration);
+
+ if (rdata->res.timer.init == 0) {
+ rdata->res.timer.init = 1;
+ clock_gettime(CLOCK_MONOTONIC, &rdata->res.timer.t_next);
+ }
+
rdata->res.timer.t_next = timespec_add(&rdata->res.timer.t_next, &t_period);
clock_gettime(CLOCK_MONOTONIC, &t_now);
if (timespec_lower(&t_now, &rdata->res.timer.t_next))
@@ -678,12 +684,6 @@ int main(int argc, char* argv[])
/* Sync timer resources with start time */
clock_gettime(CLOCK_MONOTONIC, &t_start);
- for (i = 0; i < nresources; i++) {
- rdata = &opts.resources[i];
- if (rdata->type == rtapp_timer)
- rdata->res.timer.t_next = t_start;
- }
-
/* Start the use case */
for (i = 0; i < nthreads; i++) {
tdata = &opts.threads_data[i];
diff --git a/src/rt-app_parse_config.c b/src/rt-app_parse_config.c
index 2572afb..3fdf5f5 100644
--- a/src/rt-app_parse_config.c
+++ b/src/rt-app_parse_config.c
@@ -179,7 +179,7 @@ static int init_mutex_resource(rtapp_resource_t *data, const rtapp_options_t *op
static int init_timer_resource(rtapp_resource_t *data, const rtapp_options_t *opts)
{
log_info(PIN3 "Init: %s timer", data->name);
- clock_gettime(CLOCK_MONOTONIC, &data->res.timer.t_next);
+ data->res.timer.init = 0;
}
static int init_cond_resource(rtapp_resource_t *data, const rtapp_options_t *opts)
diff --git a/src/rt-app_types.h b/src/rt-app_types.h
index cefb3a6..1075f64 100644
--- a/src/rt-app_types.h
+++ b/src/rt-app_types.h
@@ -83,6 +83,7 @@ struct _rtapp_signal {
struct _rtapp_timer {
struct timespec t_next;
+ int init;
};
/* Shared resources */
--
1.9.1
Hi all,
I've switched the sched-tools list to a public mailman group so that
anybody can subscribe to it[1].
You can post to the list by emailing sched-tools(a)lists.linaro.org.
Please note the change from the old address (an extra 'lists') which
was unfortunately unavoidable due to the way the different mail
systems are set up. If referencing the mailing list in a future
posting, please remember to correct the mailing list address.
Regards,
Amit
[1] http://lists.linaro.org/mailman/listinfo/sched-tools