diff options
author | Bryn M. Reeves <bmr@redhat.com> | 2020-02-14 18:03:11 +0000 |
---|---|---|
committer | Bryn M. Reeves <bmr@redhat.com> | 2020-02-14 18:16:35 +0000 |
commit | 73656a34ed9f041ffbd12c6b780f43c092666181 (patch) | |
tree | 24b56f5df97869d8f377e8c0f923666f8dd2c484 /Makefile | |
parent | aec21db0016ed87e4fd6fdbf760fbfb067324d7a (diff) | |
download | sos-73656a34ed9f041ffbd12c6b780f43c092666181.tar.gz |
[policies] fix LinuxPolicy performance regression (test suite)
Commit 285873a introduces a regression in the performance of
LinuxProfile class initialisation:
commit 285873a4f753822a88d475a1b030ab622bf4c72e
Author: Bryan Quigley <bryan.quigley@canonical.com>
Date: Tue Feb 11 15:03:16 2020 -0800
[policies] Detect systemd use instead of hardcoding it
All the patch does is to switch from testing self.init to
determine whether to use the SystemdInit() class or the
basic InitSystem() one, to looking for '/run/systemd/system'
in the file system.
This has more broad side effects than it might seem since
the test suite uses LinuxPolicy() as a mock policy object
for a large number of tests. Since SystemdInit() calls out
to systemctl to obtain the state of the init system this
both increases the run time for the tests and causes high
resource use in systemd itself:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1 root 20 0 177196 13504 4512 R 92.7 0.1 5:24.04 systemd
This causes the run time for the Python2 and 3 test suite
(plus pep8/pycodestyle) to grow from ~5s to over 1m20s on
my test system:
285873a~1 real 0m5.683s
285873a real 1m20.353s
Allow direct users of LinuxPolicy to override the init
system detection by specifying an init= kwarg initialised
to an InitSystem-like object directly, and use this in the
test suite to avoid the cost of initialising the full
SystemdInit() class.
Resolves: #1953
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
Diffstat (limited to 'Makefile')
0 files changed, 0 insertions, 0 deletions