Skip to content

Commit 7e0b32f

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 e425e7b commit 7e0b32f

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

Diff for: read-cache.c

+17-1
Original file line numberDiff line numberDiff line change
@@ -2054,6 +2054,17 @@ static void *load_index_extensions(void *_data)
20542054
return NULL;
20552055
}
20562056

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

2144+
trace2_thread_start("load_cache_entries");
2145+
21332146
/* iterate across all ieot blocks assigned to this thread */
21342147
for (i = p->ieot_start; i < p->ieot_start + p->ieot_blocks; i++) {
21352148
p->consumed += load_cache_entry_block(p->istate, p->ce_mem_pool,
21362149
p->offset, p->ieot->entries[i].nr, p->mmap, p->ieot->entries[i].offset, NULL);
21372150
p->offset += p->ieot->entries[i].nr;
21382151
}
2152+
2153+
trace2_thread_exit();
2154+
21392155
return NULL;
21402156
}
21412157

@@ -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)