msm: kgsl: Use the correct timestamp for the snapshot
The snapshot timestamp is currently based on wall time which makes
it very difficult to debug against a kernel log based on boot time.
It doesn't help matters that the snapshot timestamp is output in
human unfriendly hex. Use boot time instead of wall time for the
snapshot value and print it out in decimal.
Change-Id: Ic0dedbadf9b7d799a3cb4d5917787bccd350c90a
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
diff --git a/drivers/gpu/msm/kgsl_snapshot.c b/drivers/gpu/msm/kgsl_snapshot.c
index c058e95..2ee021f 100644
--- a/drivers/gpu/msm/kgsl_snapshot.c
+++ b/drivers/gpu/msm/kgsl_snapshot.c
@@ -518,6 +518,7 @@
struct kgsl_snapshot_header *header = device->snapshot;
int remain = device->snapshot_maxsize - sizeof(*header);
void *snapshot;
+ struct timespec boot;
/*
* The first hang is always the one we are interested in. To
@@ -559,7 +560,13 @@
snapshot = device->ftbl->snapshot(device, snapshot, &remain,
hang);
- device->snapshot_timestamp = get_seconds();
+ /*
+ * The timestamp is the seconds since boot so it is easier to match to
+ * the kernel log
+ */
+
+ getboottime(&boot);
+ device->snapshot_timestamp = get_seconds() - boot.tv_sec;
device->snapshot_size = (int) (snapshot - device->snapshot);
/* Freeze the snapshot on a hang until it gets read */
@@ -654,7 +661,7 @@
/* Show the timestamp of the last collected snapshot */
static ssize_t timestamp_show(struct kgsl_device *device, char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%x\n", device->snapshot_timestamp);
+ return snprintf(buf, PAGE_SIZE, "%d\n", device->snapshot_timestamp);
}
/* manually trigger a new snapshot to be collected */