diff mbox series

[U-Boot,3/6] common: iotrace: add timestamp to iotrace records

Message ID 20180525104128.7990-4-ramon.fried@gmail.com
State Superseded
Delegated to: Tom Rini
Headers show
Series Iotrace improvements | expand

Commit Message

Ramon Fried May 25, 2018, 10:41 a.m. UTC
Add timestamp to each iotrace record to aid in debugging
of IO timing access bugs.

Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
---
 common/iotrace.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Simon Glass May 26, 2018, 2:07 a.m. UTC | #1
HI Ramon,

On 25 May 2018 at 04:41, Ramon Fried <ramon.fried@gmail.com> wrote:
> Add timestamp to each iotrace record to aid in debugging
> of IO timing access bugs.
>
> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
> ---
>  common/iotrace.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/common/iotrace.c b/common/iotrace.c
> index f39885663a..3530688ab1 100644
> --- a/common/iotrace.c
> +++ b/common/iotrace.c
> @@ -27,11 +27,13 @@ enum iotrace_flags {
>   * struct iotrace_record - Holds a single I/O trace record
>   *
>   * @flags: I/O access type
> + * @timestamp: Timestamp of access
>   * @addr: Address of access
>   * @value: Value written or read
>   */
>  struct iotrace_record {
>         enum iotrace_flags flags;
> +       u64 timestamp;
>         phys_addr_t addr;
>         iovalue_t value;
>  };
> @@ -82,6 +84,7 @@ static void add_record(int flags, const void *ptr, ulong value)
>                                         sizeof(value));
>         }
>
> +       rec->timestamp = get_ticks();

Would it not be better to use timer_get_us() here?

>         rec->flags = flags;
>         rec->addr = map_to_sysmem(ptr);
>         rec->value = value;
> --
> 2.17.0
>

Regards,
Simon
Ramon Fried May 26, 2018, 6 a.m. UTC | #2
On Sat, May 26, 2018 at 5:07 AM, Simon Glass <sjg@chromium.org> wrote:
> HI Ramon,
>
> On 25 May 2018 at 04:41, Ramon Fried <ramon.fried@gmail.com> wrote:
>> Add timestamp to each iotrace record to aid in debugging
>> of IO timing access bugs.
>>
>> Signed-off-by: Ramon Fried <ramon.fried@gmail.com>
>> ---
>>  common/iotrace.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/common/iotrace.c b/common/iotrace.c
>> index f39885663a..3530688ab1 100644
>> --- a/common/iotrace.c
>> +++ b/common/iotrace.c
>> @@ -27,11 +27,13 @@ enum iotrace_flags {
>>   * struct iotrace_record - Holds a single I/O trace record
>>   *
>>   * @flags: I/O access type
>> + * @timestamp: Timestamp of access
>>   * @addr: Address of access
>>   * @value: Value written or read
>>   */
>>  struct iotrace_record {
>>         enum iotrace_flags flags;
>> +       u64 timestamp;
>>         phys_addr_t addr;
>>         iovalue_t value;
>>  };
>> @@ -82,6 +84,7 @@ static void add_record(int flags, const void *ptr, ulong value)
>>                                         sizeof(value));
>>         }
>>
>> +       rec->timestamp = get_ticks();
>
> Would it not be better to use timer_get_us() here?
Yes. I'll change it. Thanks.
>
>>         rec->flags = flags;
>>         rec->addr = map_to_sysmem(ptr);
>>         rec->value = value;
>> --
>> 2.17.0
>>
>
> Regards,
> Simon
diff mbox series

Patch

diff --git a/common/iotrace.c b/common/iotrace.c
index f39885663a..3530688ab1 100644
--- a/common/iotrace.c
+++ b/common/iotrace.c
@@ -27,11 +27,13 @@  enum iotrace_flags {
  * struct iotrace_record - Holds a single I/O trace record
  *
  * @flags: I/O access type
+ * @timestamp: Timestamp of access
  * @addr: Address of access
  * @value: Value written or read
  */
 struct iotrace_record {
 	enum iotrace_flags flags;
+	u64 timestamp;
 	phys_addr_t addr;
 	iovalue_t value;
 };
@@ -82,6 +84,7 @@  static void add_record(int flags, const void *ptr, ulong value)
 					sizeof(value));
 	}
 
+	rec->timestamp = get_ticks();
 	rec->flags = flags;
 	rec->addr = map_to_sysmem(ptr);
 	rec->value = value;