summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdmond Chung <edmondchung@google.com>2023-04-05 15:46:44 -0700
committerHolmes Chou <holmeschou@google.com>2023-04-14 13:34:56 +0000
commit9ddbde69e2884af69d8ee51152ea674e60f8bc4b (patch)
treef96c7a2fb9aa950a161621acee109f132902b602
parentf7f57cf2656919a6d4b0b9a0800e0695eda6e27c (diff)
downloadlwis-9ddbde69e2884af69d8ee51152ea674e60f8bc4b.tar.gz
Transaction: Add debug parameter to skip transaction timestamping
Bug: 277224937 Test: GCA, Testing /d/lwis/isp-fe/transaction_info and /sys/module/lwis/parameters/lwis_transaction_debug Change-Id: I28701c981a2823db9f7f7a7b5343eb6ef17879d3 Signed-off-by: Edmond Chung <edmondchung@google.com>
-rw-r--r--lwis_debug.c15
-rw-r--r--lwis_transaction.c15
2 files changed, 23 insertions, 7 deletions
diff --git a/lwis_debug.c b/lwis_debug.c
index a303a6d..8e5927e 100644
--- a/lwis_debug.c
+++ b/lwis_debug.c
@@ -99,10 +99,17 @@ static void list_transactions(struct lwis_client *client, char *k_buf, size_t k_
trans_hist->info.emit_success_event_id,
trans_hist->info.emit_error_event_id);
strlcat(k_buf, tmp_buf, k_buf_size);
- scnprintf(tmp_buf, sizeof(tmp_buf),
- " Num Entries: %zu Processed @ %lld for %lldns\n",
- trans_hist->info.num_io_entries, trans_hist->process_timestamp,
- trans_hist->process_duration_ns);
+ /* Process timestamp not recorded */
+ if (trans_hist->process_timestamp == -1) {
+ scnprintf(tmp_buf, sizeof(tmp_buf), " Num Entries: %zu\n",
+ trans_hist->info.num_io_entries);
+ } else {
+ scnprintf(tmp_buf, sizeof(tmp_buf),
+ " Num Entries: %zu Processed @ %lld for %lldns\n",
+ trans_hist->info.num_io_entries,
+ trans_hist->process_timestamp,
+ trans_hist->process_duration_ns);
+ }
strlcat(k_buf, tmp_buf, k_buf_size);
}
hist_idx++;
diff --git a/lwis_transaction.c b/lwis_transaction.c
index cf9509e..604b266 100644
--- a/lwis_transaction.c
+++ b/lwis_transaction.c
@@ -34,6 +34,9 @@
#define EXPLICIT_EVENT_COUNTER(x) \
((x) != LWIS_EVENT_COUNTER_ON_NEXT_OCCURRENCE && (x) != LWIS_EVENT_COUNTER_EVERY_TIME)
+bool lwis_transaction_debug;
+module_param(lwis_transaction_debug, bool, 0644);
+
static struct lwis_transaction_event_list *event_list_find(struct lwis_client *client,
int64_t event_id)
{
@@ -166,10 +169,14 @@ static int process_transaction(struct lwis_client *client, struct lwis_transacti
uint8_t *read_buf;
struct lwis_io_result *io_result;
const int reg_value_bytewidth = lwis_dev->native_value_bitwidth / 8;
- int64_t process_duration_ns = 0;
- int64_t process_timestamp = ktime_to_ns(lwis_get_time());
+ int64_t process_duration_ns = -1;
+ int64_t process_timestamp = -1;
unsigned long flags;
+ if (lwis_transaction_debug) {
+ process_timestamp = ktime_to_ns(lwis_get_time());
+ }
+
resp_size = sizeof(struct lwis_transaction_response_header) + resp->results_size_bytes;
read_buf = (uint8_t *)resp + sizeof(struct lwis_transaction_response_header);
resp->completion_index = -1;
@@ -281,7 +288,9 @@ static int process_transaction(struct lwis_client *client, struct lwis_transacti
resp->completion_index = i;
}
- process_duration_ns = ktime_to_ns(lwis_get_time() - process_timestamp);
+ if (lwis_transaction_debug) {
+ process_duration_ns = ktime_to_ns(lwis_get_time() - process_timestamp);
+ }
/* Use read memory barrier at the end of I/O entries if the access protocol
* allows it */