Skip to content

Commit ebd8cee

Browse files
jeffhostetlerdscho
authored andcommitted
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: abb4bb8 read-cache: load cache extensions on a worker thread 77ff112 read-cache: load cache entries on worker threads Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
1 parent cc29e0e commit ebd8cee

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

read-cache.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2026,6 +2026,17 @@ static void *load_index_extensions(void *_data)
20262026
return NULL;
20272027
}
20282028

2029+
static void *load_index_extensions_threadproc(void *_data)
2030+
{
2031+
void *result;
2032+
2033+
trace2_thread_start("load_index_extensions");
2034+
result = load_index_extensions(_data);
2035+
trace2_thread_exit();
2036+
2037+
return result;
2038+
}
2039+
20292040
/*
20302041
* A helper function that will load the specified range of cache entries
20312042
* from the memory mapped file and add them to the given index.
@@ -2102,12 +2113,17 @@ static void *load_cache_entries_thread(void *_data)
21022113
struct load_cache_entries_thread_data *p = _data;
21032114
int i;
21042115

2116+
trace2_thread_start("load_cache_entries");
2117+
21052118
/* iterate across all ieot blocks assigned to this thread */
21062119
for (i = p->ieot_start; i < p->ieot_start + p->ieot_blocks; i++) {
21072120
p->consumed += load_cache_entry_block(p->istate, p->ce_mem_pool,
21082121
p->offset, p->ieot->entries[i].nr, p->mmap, p->ieot->entries[i].offset, NULL);
21092122
p->offset += p->ieot->entries[i].nr;
21102123
}
2124+
2125+
trace2_thread_exit();
2126+
21112127
return NULL;
21122128
}
21132129

@@ -2277,7 +2293,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
22772293
int err;
22782294

22792295
p.src_offset = extension_offset;
2280-
err = pthread_create(&p.pthread, NULL, load_index_extensions, &p);
2296+
err = pthread_create(&p.pthread, NULL, load_index_extensions_threadproc, &p);
22812297
if (err)
22822298
die(_("unable to create load_index_extensions thread: %s"), strerror(err));
22832299

0 commit comments

Comments
 (0)