Skip to content

Commit 6d0ca07

Browse files
jeffhostetlermjcheetham
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 27c3221 commit 6d0ca07

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

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

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

@@ -2306,7 +2322,7 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
23062322
int err;
23072323

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

0 commit comments

Comments
 (0)