start_us = (int64_t) start_t.tv_sec * 1000000 + start_t.tv_usec;
end_us = (int64_t) end_t.tv_sec * 1000000 + end_t.tv_usec;
elapsed_us = end_us - start_us;
- fprintf (stderr, "proc %d serial %d took %d.%02d seconds\n",
- proc_nr, serial,
+ fprintf (stderr, "proc %d (%s) took %d.%02d seconds\n",
+ proc_nr,
+ proc_nr >= 0 && proc_nr < GUESTFS_PROC_NR_PROCS
+ ? function_names[proc_nr] : "UNKNOWN PROCEDURE",
(int) (elapsed_us / 1000000),
(int) ((elapsed_us / 10000) % 100));
}
) ["pv", pv_cols; "vg", vg_cols; "lv", lv_cols]
+(* Generate a list of function names, for debugging in the daemon.. *)
+and generate_daemon_names () =
+ generate_header CStyle GPLv2;
+
+ pr "#include <config.h>\n";
+ pr "\n";
+ pr "#include \"daemon.h\"\n";
+ pr "\n";
+
+ pr "/* This array is indexed by proc_nr. See guestfs_protocol.x. */\n";
+ pr "const char *function_names[] = {\n";
+ List.iter (
+ fun (name, _, proc_nr, _, _, _, _) -> pr " [%d] = \"%s\",\n" proc_nr name
+ ) daemon_functions;
+ pr "};\n";
+
(* Generate the tests. *)
and generate_tests () =
generate_header CStyle GPLv2;
generate_daemon_actions ();
close ();
+ let close = output_to "daemon/names.c" in
+ generate_daemon_names ();
+ close ();
+
let close = output_to "capitests/tests.c" in
generate_tests ();
close ();