summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Oliver Stöneberg <oliverst@online.de>2015-01-08 10:55:56 +0100
committer Oliver Stöneberg <oliverst@online.de>2015-01-08 10:55:56 +0100
commitb07ef1dc5e76ba6ca3f99ac6a18eb1405328c15b (patch)
treed17439bd9e9f1f48ebbf118602b470362c0c1df8
parent8ef233f78a3e4f2f3b82200ebd608be6cce44167 (diff)
osd_work: moved thread count printing to KEEP_STATISTICS / prevent KEEP_STATISTICS loop from going out-of-bounds (nw)
-rw-r--r--src/osd/modules/sync/work_osd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/osd/modules/sync/work_osd.c b/src/osd/modules/sync/work_osd.c
index 031884e3dd5..950f26ae530 100644
--- a/src/osd/modules/sync/work_osd.c
+++ b/src/osd/modules/sync/work_osd.c
@@ -223,10 +223,11 @@ osd_work_queue *osd_work_queue_alloc(int flags)
allocthreadnum = queue->threads + 1;
else
allocthreadnum = queue->threads;
-#if 0
- // tools like chdman are not linked with osd_printf_*
- osd_printf_verbose("osdprocs: %d effecprocs: %d threads: %d allocthreads: %d osdthreads: %d maxthreads: %d queuethreads: %d\n", osd_num_processors, numprocs, threadnum, allocthreadnum, osdthreadnum, WORK_MAX_THREADS, queue->threads);
+
+#if KEEP_STATISTICS
+ printf("osdprocs: %d effecprocs: %d threads: %d allocthreads: %d osdthreads: %d maxthreads: %d queuethreads: %d\n", osd_num_processors, numprocs, threadnum, allocthreadnum, osdthreadnum, WORK_MAX_THREADS, queue->threads);
#endif
+
queue->thread = (work_thread_info *)osd_malloc_array(allocthreadnum * sizeof(queue->thread[0]));
if (queue->thread == NULL)
goto error;
@@ -382,7 +383,7 @@ void osd_work_queue_free(osd_work_queue *queue)
allocthreadnum = queue->threads;
// output per-thread statistics
- for (threadnum = 0; threadnum <= allocthreadnum; threadnum++)
+ for (threadnum = 0; threadnum < allocthreadnum; threadnum++)
{
work_thread_info *thread = &queue->thread[threadnum];
osd_ticks_t total = thread->runtime + thread->waittime + thread->spintime;