Simon Buhrow has uploaded this change for review.

View Change

cli_classic.c: Add runtime measurement

To get an fast and easy feedback on how parameters effect runtime (e.g. clock setting, polling delays, ...).

Signed-off-by: Simon Buhrow <simon.buhrow@posteo.de>
Change-Id: I2238b3f3e6c2ab7745994662a88787fa2e86d480
---
M cli_classic.c
1 file changed, 7 insertions(+), 0 deletions(-)

git pull ssh://review.coreboot.org:29418/flashrom refs/changes/05/47805/1
diff --git a/cli_classic.c b/cli_classic.c
index ae7f6ef..0d5381f 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <stdlib.h>
#include <getopt.h>
+#include <time.h>
#include "flash.h"
#include "flashchips.h"
#include "fmap.h"
@@ -142,6 +143,7 @@
/* Probe for up to eight flash chips. */
struct flashctx flashes[8] = {{0}};
struct flashctx *fill_flash;
+ struct timespec time_start, time_end;
const char *name;
int namelen, opt, i, j;
int startchip = -1, chipcount = 0, option_index = 0, force = 0, ifd = 0, fmap = 0;
@@ -528,6 +530,8 @@
/* FIXME: Delay calibration should happen in programmer code. */
myusec_calibrate_delay();

+ timespec_get(&time_start, TIME_UTC);
+
if (programmer_init(prog, pparam)) {
msg_perr("Error: Programmer initialization failed.\n");
ret = 1;
@@ -806,6 +810,9 @@
for (i = 0; i < chipcount; i++)
free(flashes[i].chip);

+ timespec_get(&time_end, TIME_UTC);
+ msg_gdbg("Runtime: %d:%2d min:s\n", (int)((time_end.tv_sec-time_start.tv_sec) / 60), (int)(time_end.tv_sec-time_start.tv_sec) % 60);
+
layout_cleanup(&include_args);
free(filename);
free(fmapfile);

To view, visit change 47805. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-Project: flashrom
Gerrit-Branch: master
Gerrit-Change-Id: I2238b3f3e6c2ab7745994662a88787fa2e86d480
Gerrit-Change-Number: 47805
Gerrit-PatchSet: 1
Gerrit-Owner: Simon Buhrow
Gerrit-MessageType: newchange