trace2:gvfs:experiment: read_cache: annotate thread usage in read-cache

Add trace2_thread_start() and trace2_thread_exit() events to the worker
threads used to read the index.  This gives per-thread perf data.

These workers were introduced in:
abb4bb8384 read-cache: load cache extensions on a worker thread
77ff1127a4 read-cache: load cache entries on worker threads

Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
This commit is contained in:
Jeff Hostetler 2019-06-14 12:38:31 -04:00 коммит произвёл Victoria Dye
Родитель 5f21c7a0f6
Коммит 5b319bfaf1
1 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -2107,6 +2107,17 @@ static void *load_index_extensions(void *_data)
return NULL;
}
static void *load_index_extensions_threadproc(void *_data)
{
void *result;
trace2_thread_start("load_index_extensions");
result = load_index_extensions(_data);
trace2_thread_exit();
return result;
}
/*
* A helper function that will load the specified range of cache entries
* from the memory mapped file and add them to the given index.
@ -2183,12 +2194,17 @@ static void *load_cache_entries_thread(void *_data)
struct load_cache_entries_thread_data *p = _data;
int i;
trace2_thread_start("load_cache_entries");
/* iterate across all ieot blocks assigned to this thread */
for (i = p->ieot_start; i < p->ieot_start + p->ieot_blocks; i++) {
p->consumed += load_cache_entry_block(p->istate, p->ce_mem_pool,
p->offset, p->ieot->entries[i].nr, p->mmap, p->ieot->entries[i].offset, NULL);
p->offset += p->ieot->entries[i].nr;
}
trace2_thread_exit();
return NULL;
}
@ -2355,7 +2371,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
int err;
p.src_offset = extension_offset;
err = pthread_create(&p.pthread, NULL, load_index_extensions, &p);
err = pthread_create(&p.pthread, NULL, load_index_extensions_threadproc, &p);
if (err)
die(_("unable to create load_index_extensions thread: %s"), strerror(err));