aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
2014-09-24Properly initialize trace.name in find_trace_fileHEADmasterChris Mason1-1/+1
Signed-off-by: Chris Mason <clm@fb.com>
2014-04-27Fix up some strcpy and strcat usageAndrew Price2-41/+27
Fix an unchecked strcpy and strcat in plot_io_movie(): $ ./iowatcher -t foo --movie -o foo.ogv -l $(printf 'x%.0s' {1..300}) [...] *** buffer overflow detected ***: ./iowatcher terminated There was also very similar code in plot_io() so a new function plot_io_legend() was added to factor out the common string building code and replace the buggy code with asprintf(). Also add a closedir() call to an error path in traces_list() to plug a resource leak and make iowatcher Coverity-clean (ignoring some false-positives). Signed-off-by: Andrew Price <anprice@redhat.com>
2014-04-27Clean up some unused functions, make others staticAndrew Price4-71/+4
Adding -Wmissing-prototypes showed some functions could be made static and my 'findunused' script showed some functions weren't being called. This patch was tested by building from scratch and running with various combinations of options. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-04-27Update usage info and improve man pageAndrew Price2-50/+86
Bring the man page and usage string up-to-date with the new -p behaviour and improve the formatting and content of the man page. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-04-27Convert start_mpstat to run_programAndrew Price4-99/+52
For consistency and deduplication, use run_program in start_mpstat. Add the ability to pass a path to run_program, which will be opened in the spawned process and used as stdout, in order to capture mpstat output. This fixes a tricky descriptor leak in start_mpstat which could have caused a race condition if it was fixed with close(). Some output formatting tweaks have also been added and a bug from a previous patch, where tracers were killed immediately when -p wasn't specified, has been fixed. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-04-26Convert start_blktrace to run_programAndrew Price2-76/+55
Rework start_blktrace and use run_program to launch blktrace. Move the argv-building into the function so that it's easier to work with and clean it up a bit. Add a signal parameter to wait_program to optionally kill the pid with a given signal before waiting for it. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-04-26Rework --prog to make arg processing saferAndrew Price5-48/+47
Previously the --prog option required the program-to-be-run to be specified as a single string. This meant that shell escaping would be lost in translation and a sub-shell would be run. Rework --prog to not take an argument and accept the arguments left after option processing has ended as the argv for the program-to-be-run. As we have the program as an argv, run_program2() can now be used to run it, and now that run_program() is no longer used we can remove it and remove the '2' from run_program2. New usage example: # iowatcher -p -t foo -d /dev/sda3 sleep 10 running blktrace blktrace -b 8192 -a queue -a complete -a issue -a notify -D . -d /dev/sda3 -o foo running 'sleep' '10' sleep exited with 0 ... Docs have been updated accordingly. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-04-26Separate program running from waitingAndrew Price3-18/+34
Until now run_program2() was a replacement for system() so it always waited for the process to end before returning. To make this function more useful move the waiting code into a separate function and add a mechanism to expect a specific exit code. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-04-26Correct a couple of calloc callsAndrew Price1-2/+2
(Caught by Coverity.) tf->gdd_writes and tf->gdd_reads are arrays of pointers so update their allocations to use the correct element size. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-04-26Simplify temp movie directory creationAndrew Price2-16/+6
plot_io_movie() was calling create_movie_temp_dir() which unnecessarily strdup()ed a string constant leaving plot_io_movie() to free it. Replace the strdup() with a mutable char array and get rid of the free(). Merge the few remaining lines which create the movie dir into plot_io_movie(). Also prune a duplicate declaration of start_mpstat() in tracers.h Signed-off-by: Andrew Price <anprice@redhat.com>
2014-03-28Merge trace dumping functions into oneAndrew Price3-71/+50
Now that combine_blktrace_devs() takes a list of traces it's fairly generic so we might as well merge blktrace_to_dump() into it. The latter can be replaced with a call using a list with a single entry. combine_blktrace_devs() is renamed dump_traces() because that's what it does. Also eradicate the big global char array 'line' that was being used in a bunch of places along with some more unnecessary strdup()s. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-03-28Check program exit code properlyAndrew Price1-4/+15
The return value of posix_spawnp() was being checked but the exit status of the child process was being ignored. This adds checks and error reporting based on the status that waitpid returns. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-03-27Fix up directory trace processingAndrew Price4-60/+119
Similar to the fix for spaces in file names in commit 5d845e3, this patch fixes processing of directories with spaces in their names by using posix_spawnp() to run the blkparse command instead of system(). In doing so, combine_blktrace_devs() and match_trace() have been reworked to use a list structure instead of doing a lot of strdup()ing and string appending. Also make sure that trailing slashes are removed from the directory name before attempting to use it as the base of the .dump filename. Update the -t entry in the manpage to mention directory behaviour, too. Signed-off-by: Andrew Price <anprice@redhat.com>
2014-01-08Merge Jan Kara's fixesChris Mason8-64/+81
2013-11-08Fix processing of trace filenames containing spacesAndrew Price1-3/+25
blktrace_to_dump passes filenames containing spaces to blkparse via system() so only the first chunk of the string is taken to be the filename by the subprocess. This switches to using posix_spawnp() so that we can present the filename as an element of argv and avoid iowatcher failing in these cases. Signed-off-by: Andrew Price <anprice@redhat.com>
2013-11-06Add bounds checking in find_stepAndrew Price1-3/+5
Check the value of cur_mini_step is sane before using it as an index to mini_step array. Signed-off-by: Andrew Price <anprice@redhat.com>
2013-09-24Handle REQUEUE eventsJan Kara1-0/+5
When requeue event happens we have to decrease number of in-flight requests. Otherwise they drift away. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-09-24Make seconds unsignedJan Kara7-39/+53
Compiler was giving some warnings about signed vs unsigned comparisons. Although these were harmless, make seconds unsigned because they really are. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-09-24Remove duplicate defines from blkparse.cJan Kara1-7/+0
Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-09-24Skip events beyond max_secondsJan Kara3-15/+11
Skip events beyond max_seconds. This not only saves CPU time but also prevents memory corruption because not all functions were checking that given time is in the expected range. Also remove now unnecessary checks in the called functions. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-09-24Do not add events out of time range to the plotJan Kara1-1/+3
If the event is out of time range that should be plotted, do not add it. It will corrupt memory... Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-09-24Fine tune the ticksChris Mason2-2/+2
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-09-24Update the README for a few new optionsChris Mason1-1/+8
2013-09-05Fix a label overflow in plot_ioAndrew Price1-1/+2
The length of the label option wasn't being checked before strcpy()ing it into a char[256]. Use strncpy instead. Signed-off-by: Andrew Price <anprice@redhat.com>
2013-01-21Don't print a legend on the tput graphs during moviesv1.0Chris Mason1-8/+13
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-21Update the FSF address in all filesChris Mason12-13/+13
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-21Update the COPYING file to the correct addressChris Mason1-21/+19
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-20Add support for fio bandwith logs (-F logfile)Chris Mason7-6/+418
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-17Fix formatting errors in the iowatcher.1 man page.Chris Mason1-14/+15
Thanks to Andrew Price for sending me the corrected version Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-17Fix mpstat handling when the number of CPUs is notChris Mason1-3/+31
in the mpstat output Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-17Handle traces to more than once device at a timeChris Mason7-72/+340
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-14iowatcher: specify ffmpeg codecNikita Danilov1-2/+9
Add -C option to specify ffmped video code to use. Allow ffmpeg video codec to be specified on the command line. "libx264" is default. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-14Add a man page for iowatcherAndrew Price1-0/+116
Adds a man page from iowatcher. Borrows some documentation from the README file but covers all of the options found in main.c Signed-off-by: Andrew Price <anprice@redhat.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2013-01-14Fix spindle rotation in the movie modeChris Mason1-2/+2
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-10-26Fix some rounding errors around the max offsetChris Mason2-5/+4
set_gdd_bit makes sure that we don't try to set bits past the max offset we used to allocate our gdd array. But, it only does this when the function is first called, and the whole byte range for the IO we're recording may go past max offset. This adds a check to be sure we stay in the right range. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-10-23Fix crash due to missing queue actionJan Kara1-5/+8
When queue action was missing from a trace, handling of dispatch didn't quite get things right and crashed due to NULL pointer dereference. Fix it. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-10-22Add -K command line option to keep the movie svg filesChris Mason1-1/+11
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-10-22Only hash IOs if there are completion or issue eventsChris Mason1-27/+37
We use an IO hash table to keep track of the IOs in flight, and this is used to calculate the latencies from when we issue the IO to when we complete the IO. But if there are no completion events, io is never removed from the hash table. It grows very large and slows down the run. Since we already scan all the events looking for outliers, this commit checks for each major type of event during the scan. If there are no completion and no issue events, we don't bother inserting things into the hash table. If there are no completion events, we clean up during the issue event. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-10-19iowatcher: support png2theora for videosEric Sandeen2-7/+29
ffmpeg is not available on all distributions, so include Theora as an option, via png2theora, if the output movie filename ends in .ogg or .ogv Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-10-17Fix path name handling when the trace files are in the current directoryChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-10-17Fix buffer overwrite issuev1.0-rc1Yuanhan Liu1-9/+11
Current code allocates buffer for path based on strdup, which would let the size of path equals to the size of blktrace_dest_dir. But the code next that joins it with the filename of dump file, which would overwrite the buffer, and triggered an issue like following: $ ./iowatcher -t trace.dump -o trace.svg Unable to find trace file ./trace.dumpY ^ Refactoring join_path a bit to fix this issue. Cc: Liu Bo <liub.liubo@gmail.com> Signed-off-by: Yuanhan Liu <yliu.null@gmail.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-10-02Iowatcher: add blktrace destination optionsLiu Bo1-12/+48
Add 'D' for blktrace destination options so that we can save trace in the destination directory. Signed-off-by: Liu Bo <liub.liubo@gmail.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-25Per process IO graphsJan Kara5-176/+508
Add support for displaying different processes with different color in the IO graph and movie. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-21Make sure we add the xtick labels if we're only plotting IOChris Mason1-0/+1
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Merge branch 'jan'Chris Mason5-130/+339
Jan Kara's updates for xzoom and yzoom Conflicts: main.c Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Add option to set action which should be displayed in the IO graphJan Kara3-1/+32
Sometimes this is useful to see how IO scheduler or storage itself changes the IO submitted by the application. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Improve xticks logicJan Kara1-10/+50
Ticks on x axis used integral step and fixed number of ticks. That generates wrong results e.g. for 13s long trace with 10 ticks... Allow the code to somewhat alter the number of ticks and also use non-integral step. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Add options to limit time and sector rangeJan Kara1-1/+104
Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Ignore trace records beyond max_secondsJan Kara1-12/+6
Currently we report error when we find a trace record beyond max_seconds. When we allow user to set end of displayed period, records after the end of period are no longer a bug so just ignore them. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Add possibility to limit seconds from belowJan Kara3-47/+67
Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Rename seconds to max_secondsJan Kara4-63/+63
Later we will add min_seconds to complement this. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Add support for limitting IO graph offset from belowJan Kara5-41/+59
Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Fix filtering of outliers from belowJan Kara1-1/+2
There are lots of trace actions which do not carry a sector with them (e.g. plug, unplug, ...). Thus sector is 0 for them and that results in trimming of outliers from below never working. Fix the problem by accounting only Queue events in the outlier statistics. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Define mask of trace action and use it instead of opencoding the constantJan Kara1-6/+8
Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-09-10Fix typo in option descriptionJan Kara1-1/+1
Short variant of --movie is -m, not -p. Signed-off-by: Jan Kara <jack@suse.cz> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-30Check for null mpstat structs while generating plotsChris Mason1-6/+13
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-28Add -c to split the graphs up into multiple columnsChris Mason3-88/+142
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-27Fix divide by zero while calculating averagesChris Mason1-3/+6
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-27Update the README and the --help outputChris Mason2-9/+36
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-27Start support for multiple colums of plotsChris Mason3-145/+215
The movie mode is updated to put extra plots on the side. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-27Fix io line graphs at the edge of the X axisChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-27Fix the line graphs for values near the edges of the graphChris Mason1-2/+11
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-27Fix mpstat file permissionsChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-27Add initial support for flash tracingChris Mason6-42/+180
This is incomplete, but it will catch messages from the flash driver to find the actual chip an IO was sent to. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-22Add a new movie mode that maps the IOs onto a platter.Chris Mason3-31/+226
The --movie option defaults to spindle mode now, but you can choose --movie=rect or --movie=spindle as well. Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-21Switch to ffmpeg for movie encoding. Chrome and vlc like these better.Chris Mason1-3/+2
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-20Add back missing plot titleChris Mason1-1/+1
2012-08-20Fix --help definitionChris Mason1-1/+1
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-20Add mpstat.[ch] into gitChris Mason2-0/+303
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-20Add movie supportChris Mason3-126/+504
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-16Add mpstat graphing supportChris Mason8-32/+311
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
2012-08-15Initial revisionChris Mason11-0/+3355
Signed-off-by: Chris Mason <chris.mason@fusionio.com>