[clinfo] 96/148: Raw vs human output modes
Andreas Beckmann
anbe at moszumanska.debian.org
Mon Nov 17 14:09:51 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 ab1a9a7845438e2a3972b218c621a232fbf7d243
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date: Tue Nov 4 12:45:15 2014 +0100
Raw vs human output modes
---
src/clinfo.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/clinfo.c b/src/clinfo.c
index f1b9c76..1aba898 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -28,6 +28,13 @@ cl_uint num_devs_all;
cl_device_id *all_devices;
cl_device_id *device;
+enum output_modes {
+ CLINFO_HUMAN, /* more human readable */
+ CLINFO_RAW /* property-by-property */
+};
+
+enum output_modes output_mode = CLINFO_HUMAN;
+
static const char unk[] = "Unknown";
static const char none[] = "None";
static const char na[] = "n/a"; // not available
@@ -137,7 +144,9 @@ printPlatformInfo(cl_uint p)
if (traits->check_func && !traits->check_func(&pinfo_checks))
continue;
- had_error = platform_info_str(pid, traits->param, traits->pname);
+ had_error = platform_info_str(pid, traits->param,
+ output_mode == CLINFO_HUMAN ?
+ traits->pname : traits->sname);
if (had_error)
continue;
@@ -988,10 +997,14 @@ printDeviceInfo(cl_uint d)
printf(I1_STR "%s\n", "Device Extensions", extensions); \
}
-int main(void)
+int main(int argc, char *argv[])
{
cl_uint p, d;
+ /* if there's a 'raw' in the program name, switch to raw output mode */
+ if (strstr(argv[0], "raw"))
+ output_mode = CLINFO_RAW;
+
ALLOC(strbuf, 1024, "general string buffer");
bufsz = 1024;
--
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