From: Karol Lewandowski Date: Thu, 20 Sep 2018 19:32:11 +0000 (+0200) Subject: dump_systemstate: Replace extremely inefficient vconftool with buxton2ctl X-Git-Tag: accepted/tizen/unified/20181119.153038~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5991e4bda77ecc5b0f219370b2ba7fb5eb6f749d;p=platform%2Fcore%2Fsystem%2Fcrash-worker.git dump_systemstate: Replace extremely inefficient vconftool with buxton2ctl vconftool and buxton2ctl access the same data. vconftool is shell script which under the hood uses buxton2ctl. However, it does so in very inefficient manner - to get the keys it calls buxton2ctl once, but to get key values it calls buxton2ctl for each key. This causes it to fork On TM1 target with 548 keys in "db/" this means 548 fork & buxton2ctl execs. buxton2ctl gets the data from server via socket connection, meaning that it needs to connect & write request and wait for response. All of this together sums up to absurd - `buxton2ctl dump system` takes ~50ms, while `vconftool get db/ -r` takes more than 12seconds - which is roughly 250 times slower! sh-3.2# time buxton2ctl dump system >/dev/null real 0m0.050s user 0m0.040s sys 0m0.000s sh-3.2# time vconftool get db/ -r >/dev/null real 0m12.344s user 0m0.560s sys 0m1.190s With this change applied, dump_systemstate invocation time drops from 13seconds to 1.5-2sec (without logs), and from 13 seconds to 3-4secs (with logs, ie. -k -d -j options). Change-Id: I0cb042d18e5322d8246bf03ee142117217c83b4c --- diff --git a/packaging/crash-worker.spec b/packaging/crash-worker.spec index 024821a..1bdc552 100644 --- a/packaging/crash-worker.spec +++ b/packaging/crash-worker.spec @@ -41,6 +41,7 @@ Requires: zip Requires: libelf Requires: libdw Requires: %{_sbindir}/minicoredumper +Requires: %{_bindir}/buxton2ctl %description crash-manager diff --git a/src/dump_systemstate/dump_systemstate.c b/src/dump_systemstate/dump_systemstate.c index d4c0e40..f7f254d 100644 --- a/src/dump_systemstate/dump_systemstate.c +++ b/src/dump_systemstate/dump_systemstate.c @@ -188,18 +188,14 @@ int main(int argc, char *argv[]) INFORM_IF_ERROR(ret) if (is_root) { - fprintf_fd(out_fd, "\n==== System configuration (/usr/bin/vconftool get memory, db, file)\n"); - char *get_mem_args[] = {"/bin/vconftool", "get", "memory/", "-r", NULL}; + fprintf_fd(out_fd, "\n==== System configuration (/usr/bin/buxton2ctl dump memory, system)\n"); + char *get_mem_args[] = {"/usr/bin/buxton2ctl", "dump", "memory", NULL}; ret = run_command_write_fd_timeout(get_mem_args[0], get_mem_args, NULL, out_fd, NULL, 0, TIMEOUT_DEFAULT); INFORM_IF_ERROR(ret) - char *get_db_args[] = {"/bin/vconftool", "get", "db/", "-r", NULL}; + char *get_db_args[] = {"/usr/bin/buxton2ctl", "dump", "system", NULL}; ret = run_command_write_fd_timeout(get_db_args[0], get_db_args, NULL, out_fd, NULL, 0, TIMEOUT_DEFAULT); INFORM_IF_ERROR(ret) - - char *get_file_args[] = {"/bin/vconftool", "get", "file/", "-r", NULL}; - ret = run_command_write_fd_timeout(get_file_args[0], get_file_args, NULL, out_fd, NULL, 0, TIMEOUT_DEFAULT); - INFORM_IF_ERROR(ret) } if (arg_dmesg && is_root) {