3308
struct author_date_slab author_date;
3309
};
3310
3311
+static int topo_walk_atexit_registered;
3312
+static unsigned int count_explore_walked;
3313
+static unsigned int count_indegree_walked;
3314
+static unsigned int count_topo_walked;
3315
+
3316
+static void trace2_topo_walk_statistics_atexit(void)
3317
+{
3318
+ struct json_writer jw = JSON_WRITER_INIT;
3319
+
3320
+ jw_object_begin(&jw, 0);
3321
+ jw_object_intmax(&jw, "count_explore_walked", count_explore_walked);
3322
+ jw_object_intmax(&jw, "count_indegree_walked", count_indegree_walked);
3323
+ jw_object_intmax(&jw, "count_topo_walked", count_topo_walked);
3324
+ jw_end(&jw);
3325
+
3326
+ trace2_data_json("topo_walk", the_repository, "statistics", &jw);
3327
+
3328
+ jw_release(&jw);
3329
+}
3330
+
3331
static inline void test_flag_and_insert(struct prio_queue *q, struct commit *c, int flag)
3332
{
3333
if (c->object.flags & flag)
3349
if (repo_parse_commit_gently(revs->repo, c, 1) < 0)
3350
return;
3351
3352
+ count_explore_walked++;
3353
+
3354
if (revs->sort_order == REV_SORT_BY_AUTHOR_DATE)
3355
record_author_date(&info->author_date, c);
3356
3389
if (repo_parse_commit_gently(revs->repo, c, 1) < 0)
3390
return;
3391
3392
+ count_indegree_walked++;
3393
+
3394
explore_to_depth(revs, commit_graph_generation(c));
3395
3396
for (p = c->parents; p; p = p->next) {
3500
*/
3501
if (revs->sort_order == REV_SORT_IN_GRAPH_ORDER)
3502
prio_queue_reverse(&info->topo_queue);
3503
+
3504
+ if (trace2_is_enabled() && !topo_walk_atexit_registered) {
3505
+ atexit(trace2_topo_walk_statistics_atexit);
3506
+ topo_walk_atexit_registered = 1;
3507
+ }
3508
}
3509
3510
static struct commit *next_topo_commit(struct rev_info *revs)
3531
oid_to_hex(&commit->object.oid));
3532
}
3533
3534
+ count_topo_walked++;
3535
+
3536
for (p = commit->parents; p; p = p->next) {
3537
struct commit *parent = p->item;
3538
int *pi;