AgeCommit message (Collapse)Author
2016-02-09blktrace: Use number of online CPUsAbutalib Aghayev
Currently, blktrace uses _SC_NPROCESSORS_CONF to find out the number of CPUs. This is a problem, because if you reduce the number of online CPUs by passing kernel parameter maxcpus, then blktrace fails to start with the error: FAILED to start thread on CPU 4: 22/Invalid argument FAILED to start thread on CPU 5: 22/Invalid argument ... The attached patch fixes it to use _SC_NPROCESSORS_ONLN. Signed-off-by: Jens Axboe <>
2016-01-08Add the "-a discard" filter option to the blktrace.8 man pageJohn Groves
Signed-off-by: Jens Axboe <>
2015-09-15Fix warnings on newer gccJens Axboe
Signed-off-by: Jens Axboe <>
2015-09-15include sys/types.h for dev_t definitionKhem Raj
Avoids the build failures when sys/types.h does not get included indirectly through other headers. Signed-off-by: Khem Raj <> Signed-off-by: Jens Axboe <>
2015-08-20btreplay: Fix typo in scaling up the dynamic cpu set size.Josef Cejka
In get_ncpus, we default to using 4096 CPUs if _SC_NPROCESSORS_CONF isn't enabled. If that is insufficient, sched_getaffinity will fail and we retry after doubling the size of the cpu_set_t allocation. There's a typo in there that means we don't actually double the size and will loop forever allocating the same sized cpu_set_t instead. Signed-off-by: Josef Cejka <> Signed-off-by: Jeff Mahoney <> Signed-off-by: Jens Axboe <>
2015-02-18Refer to sda instead of hda in man pagesOlaf Hering
Signed-off-by: Olaf Hering <> Signed-off-by: Jens Axboe <>
2014-09-25iowatcher: wrap system() in a checker functionJens Axboe
Kills the errors on unchecked return of system() Signed-off-by: Jens Axboe <>
2014-09-25Merge branch 'for-upstream' of Axboe
Andrew says: Here are some trivial tweaks which I found were needed or desirable while adding iowatcher to the blktrace packaging in Fedora. They improve the integration of iowatcher into the tree and reduce duplication of docs.
2014-09-25Merge git:// Axboe
Signed-off-by: Jens Axboe <> Conflicts: iowatcher/Makefile
2014-09-25Add iowatcher requirements to READMEAndrew Price
Merge the requirements bits of iowatcher/README into README Signed-off-by: Andrew Price <>
2014-09-25iowatcher: check the return value from write()Chris Mason
Signed-off-by: Chris Mason <>
2014-09-25iowatcher: fixup the MakefileChris Mason
We were setting C=gcc instead of CC=gcc, and using -O0. Fix both. Signed-off-by: Chris Mason <>
2014-09-25iowatcher: Remove iowatcher/READMEAndrew Price
This README is getting out-of-date and its contents are duplicated in the iowatcher manpage which is up-to-date, so remove it to reduce duplication of effort. Signed-off-by: Andrew Price <>
2014-09-25iowatcher: Move iowatcher.1 into doc directoryAndrew Price
iowatcher's manpage wasn't being installed with the other manpages so add it to the doc directory. Signed-off-by: Andrew Price <>
2014-09-25iowatcher: Add iowatcher to .gitignoreAndrew Price
Signed-off-by: Andrew Price <>
2014-09-24Makefile: ensure that iowatcher gets cleanedJens Axboe
Signed-off-by: Jens Axboe <>
2014-09-24blktrace 1.1.0blktrace-1.1.0Jens Axboe
Bump it up to a full 1.1 since we now include iowatcher. Signed-off-by: Jens Axboe <>
2014-09-24iowatcher: add iowatcher to the main blktrace MakefileChris Mason
Signed-off-by: Chris Mason <>
2014-09-24Merge the iowatcher repositoryChris Mason
2014-09-24iowatcher: Properly initialize in find_trace_fileChris Mason
Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Fix up some strcpy and strcat usageAndrew Price
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 <>
2014-09-24iowatcher: Clean up some unused functions, make others staticAndrew Price
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 <>
2014-09-24iowatcher: Update usage info and improve man pageAndrew Price
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 <>
2014-09-24iowatcher: Convert start_mpstat to run_programAndrew Price
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 <>
2014-09-24iowatcher: Convert start_blktrace to run_programAndrew Price
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 <>
2014-09-24iowatcher: Rework --prog to make arg processing saferAndrew Price
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 <>
2014-09-24iowatcher: Separate program running from waitingAndrew Price
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 <>
2014-09-24iowatcher: Correct a couple of calloc callsAndrew Price
(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 <>
2014-09-24iowatcher: Simplify temp movie directory creationAndrew Price
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 <>
2014-09-24iowatcher: Merge trace dumping functions into oneAndrew Price
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 <>
2014-09-24iowatcher: Check program exit code properlyAndrew Price
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 <>
2014-09-24iowatcher: Fix up directory trace processingAndrew Price
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 <>
2014-09-24iowatcher: Handle REQUEUE eventsJan Kara
When requeue event happens we have to decrease number of in-flight requests. Otherwise they drift away. Signed-off-by: Jan Kara <> Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Make seconds unsignedJan Kara
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 <> Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Remove duplicate defines from blkparse.cJan Kara
Signed-off-by: Jan Kara <> Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Skip events beyond max_secondsJan Kara
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 <> Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Do not add events out of time range to the plotJan Kara
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 <> Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Fine tune the ticksChris Mason
Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Update the README for a few new optionsChris Mason
2014-09-24iowatcher: Fix processing of trace filenames containing spacesAndrew Price
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 <>
2014-09-24iowatcher: Add bounds checking in find_stepAndrew Price
Check the value of cur_mini_step is sane before using it as an index to mini_step array. Signed-off-by: Andrew Price <>
2014-09-24iowatcher: Fix a label overflow in plot_ioAndrew Price
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 <>
2014-09-24iowatcher: Don't print a legend on the tput graphs during moviesChris Mason
Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Update the FSF address in all filesChris Mason
Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Update the COPYING file to the correct addressChris Mason
Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Add support for fio bandwith logs (-F logfile)Chris Mason
Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Fix formatting errors in the iowatcher.1 man page.Chris Mason
Thanks to Andrew Price for sending me the corrected version Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Fix mpstat handling when the number of CPUs is notChris Mason
in the mpstat output Signed-off-by: Chris Mason <>
2014-09-24iowatcher: Handle traces to more than once device at a timeChris Mason
Signed-off-by: Chris Mason <>
2014-09-24iowatcher: iowatcher: specify ffmpeg codecNikita Danilov
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 <>