dump_systemstate: Replace extremely inefficient vconftool with buxton2ctl 11/189811/7
authorKarol Lewandowski <k.lewandowsk@samsung.com>
Thu, 20 Sep 2018 19:32:11 +0000 (21:32 +0200)
committerKarol Lewandowski <k.lewandowsk@samsung.com>
Fri, 16 Nov 2018 13:00:17 +0000 (14:00 +0100)
commit5991e4bda77ecc5b0f219370b2ba7fb5eb6f749d
tree96158f0473743fab3f88720caf1309ab1875f5df
parent6accf65c59124e5a70e6034922ad14f8853fc511
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
packaging/crash-worker.spec
src/dump_systemstate/dump_systemstate.c