mirror of
https://review.coreboot.org/flashrom.git
synced 2025-09-13 16:51:58 +02:00
cli_classic.c: Print runtime measurement in seconds in debug
To get a fast and easy feedback on how parameters affect runtime (e.g. clock setting, polling delays, etc). The runtime is measured starting from programmer_init and to programmer_shutdown, inclusive. Message is displayed in debug verbosity level. Signed-off-by: Simon Buhrow <simon.buhrow@posteo.de> Change-Id: I2238b3f3e6c2ab7745994662a88787fa2e86d480 Co-Developed-by: Anastasia Klimchuk <aklm@flashrom.org> Reviewed-on: https://review.coreboot.org/c/flashrom/+/47805 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
This commit is contained in:

committed by
Anastasia Klimchuk

parent
008919aa69
commit
182902ee01
@@ -27,6 +27,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cli_getopt.h>
|
#include <cli_getopt.h>
|
||||||
#include <cli_output.h>
|
#include <cli_output.h>
|
||||||
|
#include <time.h>
|
||||||
#include "flash.h"
|
#include "flash.h"
|
||||||
#include "flashchips.h"
|
#include "flashchips.h"
|
||||||
#include "fmap.h"
|
#include "fmap.h"
|
||||||
@@ -1049,6 +1050,7 @@ int main(int argc, char *argv[])
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
int all_matched_count = 0;
|
int all_matched_count = 0;
|
||||||
const char **all_matched_names = NULL;
|
const char **all_matched_names = NULL;
|
||||||
|
time_t time_start, time_end;
|
||||||
|
|
||||||
struct cli_options options = { 0 };
|
struct cli_options options = { 0 };
|
||||||
static const char optstring[] = "r::Rw::v::nNVEfc:l:i:p:Lzho:x";
|
static const char optstring[] = "r::Rw::v::nNVEfc:l:i:p:Lzho:x";
|
||||||
@@ -1196,6 +1198,8 @@ int main(int argc, char *argv[])
|
|||||||
if (flashrom_init(1))
|
if (flashrom_init(1))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
|
time(&time_start);
|
||||||
|
|
||||||
if (programmer_init(options.prog, options.pparam)) {
|
if (programmer_init(options.prog, options.pparam)) {
|
||||||
msg_perr("Error: Programmer initialization failed.\n");
|
msg_perr("Error: Programmer initialization failed.\n");
|
||||||
ret = 1;
|
ret = 1;
|
||||||
@@ -1536,6 +1540,11 @@ out:
|
|||||||
flashrom_data_free(all_matched_names);
|
flashrom_data_free(all_matched_names);
|
||||||
|
|
||||||
free_options(&options);
|
free_options(&options);
|
||||||
|
|
||||||
|
time(&time_end);
|
||||||
|
msg_gdbg("Runtime from programmer init to shutdown: %dmin%2dsec\n",
|
||||||
|
(int)(difftime(time_end, time_start) / 60), (int)(difftime(time_end, time_start)) % 60);
|
||||||
|
|
||||||
ret |= close_logfile();
|
ret |= close_logfile();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user