Skip to content

Commit 318d6a8

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 46d3ebe commit 318d6a8

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
@@ -2056,6 +2056,17 @@ static void *load_index_extensions(void *_data)
20562056
return NULL;
20572057
}
20582058

2059+
static void *load_index_extensions_threadproc(void *_data)
2060+
{
2061+
void *result;
2062+
2063+
trace2_thread_start("load_index_extensions");
2064+
result = load_index_extensions(_data);
2065+
trace2_thread_exit();
2066+
2067+
return result;
2068+
}
2069+
20592070
/*
20602071
* A helper function that will load the specified range of cache entries
20612072
* from the memory mapped file and add them to the given index.
@@ -2132,12 +2143,17 @@ static void *load_cache_entries_thread(void *_data)
21322143
struct load_cache_entries_thread_data *p = _data;
21332144
int i;
21342145

2146+
trace2_thread_start("load_cache_entries");
2147+
21352148
/* iterate across all ieot blocks assigned to this thread */
21362149
for (i = p->ieot_start; i < p->ieot_start + p->ieot_blocks; i++) {
21372150
p->consumed += load_cache_entry_block(p->istate, p->ce_mem_pool,
21382151
p->offset, p->ieot->entries[i].nr, p->mmap, p->ieot->entries[i].offset, NULL);
21392152
p->offset += p->ieot->entries[i].nr;
21402153
}
2154+
2155+
trace2_thread_exit();
2156+
21412157
return NULL;
21422158
}
21432159

@@ -2305,7 +2321,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
23052321
int err;
23062322

23072323
p.src_offset = extension_offset;
2308-
err = pthread_create(&p.pthread, NULL, load_index_extensions, &p);
2324+
err = pthread_create(&p.pthread, NULL, load_index_extensions_threadproc, &p);
23092325
if (err)
23102326
die(_("unable to create load_index_extensions thread: %s"), strerror(err));
23112327

0 commit comments

Comments
 (0)