Optimize execution: Use async threads for individual slots
Since the slots can be individually detected and parsed for FRU
contents, they don't have to be accessed sequentially. We can run the
bifurcation detection concurrently using threads.
Creating async threads for each host and also async threads for each
slot within the host.
The side effect of this change is only in logging. The logs are
interleaved.
Tested:
Before this optimization:
System with 6 slots and only 2 slots populated with device.
Time using `$time pcie-bifucation`:
real 0m40.051s
user 0m0.001s
sys 0m0.015s
Context: 2 slots returned immediately while 4 slots waited for eeprom
costing 40seconds.
After optimization:
Same system setup.
Time using `$time pcie-bifucation`:
real 0m10.025s
user 0m0.019s
sys 0m0.000s
All 6 slot processing ran in parallel. 4 slots waited for 10 seconds.
Google-Bug-Id: 328112981
Change-Id: Ic22d19b2c3bb6b51b6b50e4483e738ab6ad42587
Signed-off-by: Vivekanand Veeracholan <vveerach@google.com>
2 files changed