summaryrefslogtreecommitdiff
path: root/util/ectool.c
diff options
context:
space:
mode:
authorAseda Aboagye <aaboagye@google.com>2018-08-03 10:42:36 -0700
committerchrome-bot <chrome-bot@chromium.org>2018-08-10 05:08:33 -0700
commita8226e33836ed99dbde26e754e61222ad5a647bd (patch)
tree2b8005388c285658e5c656e49b9ee2af2e5d5c40 /util/ectool.c
parent003c9d50b7ff38041dbd3582f386bc886a68dba5 (diff)
downloadchrome-ec-a8226e33836ed99dbde26e754e61222ad5a647bd.tar.gz
fpsensor: Add timing statistics.
This commit adds some basic timing statistics around fingerprint capture, matching, and overall timing for returning a response for a fingerprint. A new host command is added, EC_CMD_FP_STATS, which returns these metrics. Additionally, ectool has been extended with the `fpstats` to command retrieve these metrics. BUG=b:111316382 BRANCH=None TEST=Flash nocturne_fp, perform capture and match, view results using ectool and verify that they are reasonable. Change-Id: Ib675116eebc8131d7b30e721d00eccfdb8905821 Signed-off-by: Aseda Aboagye <aaboagye@google.com> Reviewed-on: https://chromium-review.googlesource.com/1162961 Commit-Ready: Aseda Aboagye <aaboagye@chromium.org> Tested-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-by: Nicolas Norvez <norvez@chromium.org>
Diffstat (limited to 'util/ectool.c')
-rw-r--r--util/ectool.c37
1 files changed, 37 insertions, 0 deletions
diff --git a/util/ectool.c b/util/ectool.c
index 2af028b3ca..929d5a4c65 100644
--- a/util/ectool.c
+++ b/util/ectool.c
@@ -132,6 +132,8 @@ const char help_str[] =
" Prints information about the Fingerprint sensor\n"
" fpmode [capture|deepsleep|fingerdown|fingerup]\n"
" Configure/Read the fingerprint sensor current mode\n"
+ " fpstats\n"
+ " Prints timing statisitcs relating to capture and matching\n"
" fptemplate [<infile>|<index 0..2>]\n"
" Add a template if <infile> is provided, else dump it\n"
" forcelidopen <enable>\n"
@@ -1409,6 +1411,40 @@ int cmd_fp_mode(int argc, char *argv[])
return 0;
}
+int cmd_fp_stats(int argc, char *argv[])
+{
+ struct ec_response_fp_stats r;
+ int rv;
+ unsigned long long ts;
+
+ rv = ec_command(EC_CMD_FP_STATS, 0, NULL, 0, &r, sizeof(r));
+ if (rv < 0)
+ return rv;
+
+ ts = (uint64_t)r.overall_t0.hi << 32 | r.overall_t0.lo;
+ printf("FP stats (t0=%llu us):\n", ts);
+ printf("Last capture time: ");
+ if (r.timestamps_invalid & FPSTATS_CAPTURE_INV)
+ printf("Invalid\n");
+ else
+ printf("%d us\n", r.capture_time_us);
+
+ printf("Last matching time: ");
+ if (r.timestamps_invalid & FPSTATS_MATCHING_INV)
+ printf("Invalid\n");
+ else
+ printf("%d us (finger: %d)\n", r.matching_time_us,
+ r.template_matched);
+
+ printf("Last overall time: ");
+ if (r.timestamps_invalid)
+ printf("Invalid\n");
+ else
+ printf("%d us\n", r.overall_time_us);
+
+ return 0;
+}
+
int cmd_fp_info(int argc, char *argv[])
{
struct ec_response_fp_info r;
@@ -8233,6 +8269,7 @@ const struct command commands[] = {
{"fpframe", cmd_fp_frame},
{"fpinfo", cmd_fp_info},
{"fpmode", cmd_fp_mode},
+ {"fpstats", cmd_fp_stats},
{"fptemplate", cmd_fp_template},
{"gpioget", cmd_gpio_get},
{"gpioset", cmd_gpio_set},