Commit Graph

8 Commits

Author SHA1 Message Date
Richard Hughes
38dfdfd42e Convert FuProgress to a FINAL object
We're not going to subclass this, and making it final saves during startup:

 * 300K calls of fu_progress_get_instance_private()
 * 280K calls of fu_progress_get_step_weighting()
2022-12-11 20:26:15 +00:00
Richard Hughes
b50b67107f Add fu_progress_to_string() to make debugging easier 2022-10-27 15:29:32 +01:00
Richard Hughes
d629240a83 trivial: Remove the padding from FuXxxClass structs
The library is now tied to the current fwupd version, so we can break API.
2022-09-28 14:42:04 +01:00
Richard Hughes
cf9ebdb703 Add startup profiling functionality
Using `sudo FWUPD_PROFILE=10 ./src/fwupd --verbose` will print a
dump of startup times onto the console so that we can debug which
plugin is slowing down system startup. For example:

    ../src/fu-engine.c:5409:plugins-coldplug [108.55ms]:
        ../plugins/amt/fu-plugin-amt.c:437:amt [27.14ms]:
            :create-context [12.66ms]
            :get-version [8.44ms]
            :add-device [3.95ms]
2022-06-14 22:08:02 +01:00
Richard Hughes
9b29d70f31 Add a progress flag to indicate for when the child returns early
Using `fu_progress_finished(fu_progress_get_child(progress))` is IMHO
a hacky workaround.
2022-06-14 14:31:19 +01:00
Richard Hughes
dc91d59f8e Remove the recently added fu_progress_add_step_full()
Just break API instead.
2022-06-03 13:47:11 -05:00
Richard Hughes
5ef0ae182d Add a 'name' attribute to each FuProgress step
This allows us to print better warning strings, and in the future
would allow us to profile each operation in a meaningful way.

Also, add context to some of the progress steps as required.
2022-06-01 15:05:43 +01:00
Richard Hughes
40cd18fa97 Allow using a per-device global percentage completion
It's actually quite hard to build a front-end for fwupd at the moment
as you're never sure when the progress bar is going to zip back to 0%
and start all over again. Some plugins go 0..100% for write, others
go 0..100% for erase, then again for write, then *again* for verify.

By creating a helper object we can easily split up the progress of the
specific task, e.g. write_firmware().

We can encode at the plugin level "the erase takes 50% of the time, the
write takes 40% and the read takes 10%". This means we can have a
progressbar which goes up just once at a consistent speed.
2021-09-13 14:28:15 +01:00