@@ -2220,6 +2220,16 @@ int do_read_index(struct index_state *istate, const char *path, int must_exist)
2220
2220
load_index_extensions (& p );
2221
2221
}
2222
2222
munmap ((void * )mmap , mmap_size );
2223
+
2224
+ /*
2225
+ * TODO trace2: replace "the_repository" with the actual repo instance
2226
+ * that is associated with the given "istate".
2227
+ */
2228
+ trace2_data_intmax ("index" , the_repository , "read/version" ,
2229
+ istate -> version );
2230
+ trace2_data_intmax ("index" , the_repository , "read/cache_nr" ,
2231
+ istate -> cache_nr );
2232
+
2223
2233
return istate -> cache_nr ;
2224
2234
2225
2235
unmap :
@@ -2251,9 +2261,17 @@ int read_index_from(struct index_state *istate, const char *path,
2251
2261
if (istate -> initialized )
2252
2262
return istate -> cache_nr ;
2253
2263
2264
+ /*
2265
+ * TODO trace2: replace "the_repository" with the actual repo instance
2266
+ * that is associated with the given "istate".
2267
+ */
2268
+ trace2_region_enter_printf ("index" , "do_read_index" , the_repository ,
2269
+ "%s" , path );
2254
2270
trace_performance_enter ();
2255
2271
ret = do_read_index (istate , path , 0 );
2256
2272
trace_performance_leave ("read cache %s" , path );
2273
+ trace2_region_leave_printf ("index" , "do_read_index" , the_repository ,
2274
+ "%s" , path );
2257
2275
2258
2276
split_index = istate -> split_index ;
2259
2277
if (!split_index || is_null_oid (& split_index -> base_oid )) {
@@ -2269,7 +2287,11 @@ int read_index_from(struct index_state *istate, const char *path,
2269
2287
2270
2288
base_oid_hex = oid_to_hex (& split_index -> base_oid );
2271
2289
base_path = xstrfmt ("%s/sharedindex.%s" , gitdir , base_oid_hex );
2290
+ trace2_region_enter_printf ("index" , "shared/do_read_index" ,
2291
+ the_repository , "%s" , base_path );
2272
2292
ret = do_read_index (split_index -> base , base_path , 1 );
2293
+ trace2_region_leave_printf ("index" , "shared/do_read_index" ,
2294
+ the_repository , "%s" , base_path );
2273
2295
if (!oideq (& split_index -> base_oid , & split_index -> base -> oid ))
2274
2296
die (_ ("broken index, expect %s in %s, got %s" ),
2275
2297
base_oid_hex , base_path ,
@@ -2976,6 +2998,16 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
2976
2998
istate -> timestamp .sec = (unsigned int )st .st_mtime ;
2977
2999
istate -> timestamp .nsec = ST_MTIME_NSEC (st );
2978
3000
trace_performance_since (start , "write index, changed mask = %x" , istate -> cache_changed );
3001
+
3002
+ /*
3003
+ * TODO trace2: replace "the_repository" with the actual repo instance
3004
+ * that is associated with the given "istate".
3005
+ */
3006
+ trace2_data_intmax ("index" , the_repository , "write/version" ,
3007
+ istate -> version );
3008
+ trace2_data_intmax ("index" , the_repository , "write/cache_nr" ,
3009
+ istate -> cache_nr );
3010
+
2979
3011
return 0 ;
2980
3012
}
2981
3013
@@ -2995,7 +3027,18 @@ static int commit_locked_index(struct lock_file *lk)
2995
3027
static int do_write_locked_index (struct index_state * istate , struct lock_file * lock ,
2996
3028
unsigned flags )
2997
3029
{
2998
- int ret = do_write_index (istate , lock -> tempfile , 0 );
3030
+ int ret ;
3031
+
3032
+ /*
3033
+ * TODO trace2: replace "the_repository" with the actual repo instance
3034
+ * that is associated with the given "istate".
3035
+ */
3036
+ trace2_region_enter_printf ("index" , "do_write_index" , the_repository ,
3037
+ "%s" , lock -> tempfile -> filename .buf );
3038
+ ret = do_write_index (istate , lock -> tempfile , 0 );
3039
+ trace2_region_leave_printf ("index" , "do_write_index" , the_repository ,
3040
+ "%s" , lock -> tempfile -> filename .buf );
3041
+
2999
3042
if (ret )
3000
3043
return ret ;
3001
3044
if (flags & COMMIT_LOCK )
@@ -3080,7 +3123,13 @@ static int write_shared_index(struct index_state *istate,
3080
3123
int ret ;
3081
3124
3082
3125
move_cache_to_base_index (istate );
3126
+
3127
+ trace2_region_enter_printf ("index" , "shared/do_write_index" ,
3128
+ the_repository , "%s" , (* temp )-> filename .buf );
3083
3129
ret = do_write_index (si -> base , * temp , 1 );
3130
+ trace2_region_enter_printf ("index" , "shared/do_write_index" ,
3131
+ the_repository , "%s" , (* temp )-> filename .buf );
3132
+
3084
3133
if (ret )
3085
3134
return ret ;
3086
3135
ret = adjust_shared_perm (get_tempfile_path (* temp ));
0 commit comments