aboutsummaryrefslogtreecommitdiff
path: root/lib/test_overflow.c
diff options
context:
space:
mode:
authorSteven Rostedt (VMware) <[email protected]>2019-08-28 15:05:29 -0400
committerArnaldo Carvalho de Melo <[email protected]>2019-08-29 08:36:12 -0300
commit301011ba622513cb41ced59973972204e0da2f71 (patch)
tree0e9cee872cef88d9e31dc0923adf8e1297106fe2 /lib/test_overflow.c
parentb0215e2d6a18d8331b2d4a8b38ccf3eff783edb1 (diff)
tools lib traceevent: Remove unneeded qsort and uses memmove instead
While reading a trace data file that had 100,000s of tasks, the process took an extremely long time. I profiled it down to add_new_comm(), which was doing a qsort() call on an array that was pretty much already sorted (all but the last element. qsort() isn't very efficient when dealing with mostly sorted arrays, and this definitely showed its issues. When adding a new task to the task list, instead of using qsort(), do another bsearch() with a function that will find the element before where the new task will be inserted in. Then simply shift the rest of the array, and insert the task where it belongs. Fixes: f7d82350e597d ("tools/events: Add files to create libtraceevent.a") Signed-off-by: Steven Rostedt (VMware) <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: [email protected] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'lib/test_overflow.c')
0 files changed, 0 insertions, 0 deletions