[clinfo] 21/148: Present the timer offset in a nicer way

Andreas Beckmann anbe at moszumanska.debian.org
Mon Nov 17 14:09:40 UTC 2014


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch clinfo
in repository clinfo.

commit 94a1224a7903c465800a817bae6d8bd4c53056dd
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Fri Jun 7 17:38:32 2013 +0200

    Present the timer offset in a nicer way
    
    In seconds, it gives the "start time" of the device. Display this as a
    date.
---
 src/clinfo.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/src/clinfo.c b/src/clinfo.c
index 61df7ea..24dc44d 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -8,6 +8,7 @@
 #include <CL/cl_ext.h>
 #endif
 
+#include <time.h>
 #include <string.h>
 
 #include "error.h"
@@ -596,8 +597,16 @@ printDeviceInfo(cl_uint d)
 	STR_PRINT(INDENT "Profiling", bool_str[!!(queueprop & CL_QUEUE_PROFILING_ENABLE)]);
 	SZ_PARAM(PROFILING_TIMER_RESOLUTION, "Profiling timer resolution", "ns");
 	if (*has_amd) {
-		// TODO print this in a more meaningful way
-		LONG_PARAM(PROFILING_TIMER_OFFSET_AMD, "Profiling timer offset since Epoch (AMD)", "ns");
+		time_t time;
+		char *nl;
+		GET_PARAM(PROFILING_TIMER_OFFSET_AMD, ulongval);
+		time = ulongval/(1000000000UL);
+		strncpy(strbuf, ctime(&time), bufsz);
+		nl = strstr(strbuf, "\n");
+		if (nl) *nl = '\0'; // kill the newline generated by ctime
+
+		printf(I1_STR "%luns (%s)\n", "Profiling timer offset since Epoch (AMD)",
+			ulongval, strbuf);
 	}
 
 	printf(I1_STR "\n", "Execution capabilities");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list