<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Apr 20, 2013, at 7:41 AM, Sisu Xi <<a href="mailto:xisisu@gmail.com">xisisu@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi, Björn:<div><br></div><div style="">Could you please provide some readme file or Makefile in this tools? That would help us understand the code better.</div><div style=""><br></div><div style="">Thanks very much!</div>
<div style=""><br></div><div style="">Sisu</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 18, 2013 at 12:41 PM, Björn Brandenburg <span dir="ltr"><<a href="mailto:bbb@mpi-sws.org" target="_blank">bbb@mpi-sws.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto; "><div class="im">On Apr 17, 2013, at 7:55 PM, Jonathan Herman <<a href="mailto:hermanjl@cs.unc.edu">hermanjl@cs.unc.edu</a>> wrote:<br>
<br>
> A python example of this process can be found here: <a href="https://github.com/hermanjl/experiment-scripts/blob/master/parse/sched.py" target="_blank">https://github.com/hermanjl/experiment-scripts/blob/master/parse/sched.py</a>. That script does not maintain a heap to parse out of order records; it just ignores them.<br>
><br>
><br>
> On Wed, Apr 17, 2013 at 1:45 PM, Glenn Elliott <<a href="mailto:gelliott@cs.unc.edu">gelliott@cs.unc.edu</a>> wrote:<br>
> Just for clarification about out-of-order records: records are in a partially sorted order. You only need a sorted lookahead buffer of a few hundred records to be reasonably sure that your records are in order.<br>
><br>
><br>
> On Apr 17, 2013, at 1:43 PM, Glenn Elliott <<a href="mailto:gelliott@cs.unc.edu">gelliott@cs.unc.edu</a>> wrote:<br>
><br>
>> Hi Sisu,<br>
>><br>
>> I believe you should compute deadline misses by analyzing shech_trace logs. /dev/litmus/sched_trace# has a character device for each CPU. See "Recording Scheduling Traces" here: <a href="https://wiki.litmus-rt.org/litmus/Tracing" target="_blank">https://wiki.litmus-rt.org/litmus/Tracing</a><br>
>><br>
>> You will have to write your own tool to combine the binary recordings for each CPU (each is timestamped). The easiest way to do this is:<br>
>> 1) mmap() each sched_trace file into your analysis application.<br>
>> 2) Treat each mmap()'ed file as a giant C-array of "struct st_event_record". You may want to #include sched_trace.h from litmus-rt/include/litmus to get the struct definitions.<br>
>> 3) Records can appear out of order, so for each stream, take the first 50-or-so records and put them into a single timestamp-ordered minheap.<br>
>> 4) Process each record one at a time by popping the first record on the min-heap. Keep the min-heap full by moving more records from the arrays.<br>
>><br>
>> (An alternative approach is to qsort() each array (or just the first X-elements of the array), and process the record with the smallest timestamp at the heads of the record streams.)<br>
>><br>
>> Detecting deadline misses is then pretty straight forward once you've got this set up. A job can be uniquely identified by its TID, and Job Number. Every job has one release record, which includes a deadline. Correlate this release record (by matching <TID, Job#>) to a unique completion record. A deadline miss has occurred if the completion time is later than the deadline.<br>
>><br>
>> Some tips:<br>
>> (1) The user processes' notion of a job can differ from the kernel's notion of a job if you use budget enforcement. Accounting for this requires more complex processing of the sched_trace data. I have some patches in the works that makes this correlation easier to do, but it's not ready for prime-time.<br>
>> (2) If your system is severely overutilized, that the regular tasks that read the sched_trace buffers and write them to disk can be starved. This can cause the sched_trace ring buffers to overflow, resulting in the loss of tracing data. You can control the size of the sched_trace buffers at Litmus compilation time (see CONFIG_SCHED_TASK_TRACE_SHIFT). However, the kernel may refuse to compile if CONFIG_SCHED_TASK_TRACE_SHIFT and NR_CPUS lead to too much sched_trace buffer space---the binary kernel image becomes too big. You have to hack other aspects of the kernel to get larger buffers, but it is tricky. Let me know if you run into this problem.<br>
>> (3) (This holds for ft_tracing as well.) I find it easier to dump logs to shared memory (RAM disk) during tracing because this causes fewer overheads. I then copy the trace data out of RAM and write it to disk after experimentation is over. Ubuntu has a RAM disk already set up for you at /dev/shm. Just dump data to /dev/shm and read back the files later. Of course, your system has to have sufficient RAM to make this work.<br>
<br>
<br>
</div>Just to add my version of the same: I've pushed a repository to <a href="https://github.com/brandenburg/sched-trace-tools" target="_blank">https://github.com/brandenburg/sched-trace-tools</a>. There's a tool called st_job_stats that will convert sched_trace data into a CSV table with the following columns:<br>
<br>
- Task ID (PID)<br>
- Job ID<br>
- Period<br>
- Response time<br>
- Did the job miss its deadline?<br>
- Lateness = finish time - absolute deadline<br>
- Tardiness = max(0, Lateness)<br>
<br>
There are multiple filtering options for st_job_stats. Import the resulting table(s) into any spreadsheet app to compute the deadline miss ratios, statistics concerning response times, etc. Hope this helps.<br></blockquote></div></div></blockquote></div><br><div><br></div><div>Sorry, this is unsupported code. I don't have time to offer much assistance. It's relatively clean code, though, so it should be straightforward to read.</div><div><br></div><div>- Björn</div><div><br></div><div><br></div><div><br></div><div><br></div></body></html>