From 12fac3c112b56080de004a3dfd77a9d1b73a883d Mon Sep 17 00:00:00 2001 From: Jordan Crouse Date: Thu, 14 Feb 2013 14:11:44 -0700 Subject: [PATCH] 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 --- drivers/gpu/msm/kgsl_snapshot.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/msm/kgsl_snapshot.c b/drivers/gpu/msm/kgsl_snapshot.c index c058e957366..2ee021f0a0d 100644 --- a/drivers/gpu/msm/kgsl_snapshot.c +++ b/drivers/gpu/msm/kgsl_snapshot.c @@ -518,6 +518,7 @@ int kgsl_device_snapshot(struct kgsl_device *device, int hang) 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 @@ int kgsl_device_snapshot(struct kgsl_device *device, int hang) 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 @@ done: /* 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 */