Skip to content

Commit b386bba

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 <[email protected]>
1 parent 0333672 commit b386bba

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
@@ -2027,6 +2027,17 @@ static void *load_index_extensions(void *_data)
20272027
return NULL;
20282028
}
20292029

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

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

@@ -2278,7 +2294,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
22782294
int err;
22792295

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

0 commit comments

Comments
 (0)