public inbox for igt-dev@lists.freedesktop.org
 help / color / mirror / Atom feed
From: Tvrtko Ursulin <tvrtko.ursulin@linux.intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>, igt-dev@lists.freedesktop.org
Cc: Intel-gfx@lists.freedesktop.org,
	Eero Tamminen <eero.t.tamminen@intel.com>,
	3.14pi@ukr.net
Subject: Re: [Intel-gfx] [IGT 1/2] tools/intel_gpu_top: Add support for stdout logging
Date: Mon, 11 Feb 2019 17:08:45 +0000	[thread overview]
Message-ID: <e2556be5-7a01-6e39-a218-3808bb7935f5@linux.intel.com> (raw)
In-Reply-To: <154988768095.15715.17378014049195594176@skylake-alporthouse-com>


On 11/02/2019 12:21, Chris Wilson wrote:
> Quoting Tvrtko Ursulin (2019-02-11 11:45:22)
>> +static enum {
>> +       INTERACTIVE,
>> +       STDOUT,
>> +       JSON
>> +} output_mode;
>> +
>> +struct cnt_item {
>> +       struct pmu_counter *pmu;
> 
> /* "%*.*f", fmt_d, fmt_dd, X */
> 
> I tried fmt_d == fmt_width and fmt_dd == fmt_decimals
> 
> It's called field width and precision in the manpage, so
> maybe fmt_width and fmt_precision.

Makes sense indeed.

> Having figured that out, the use makes sense.
> 
>> +       unsigned int fmt_d;
>> +       unsigned int fmt_dd;
>> +       double d;
>> +       double t;
>> +       double s;
>> +       const char *name;
>> +       const char *unit;
>> +
>> +       /* Internal fields. */
>> +       char buf[16];
>> +};
>> +
>> +struct cnt_group {
>> +       const char *name;
>> +       const char *display_name;
>> +       struct cnt_item *items;
>> +};
>> +
>> +static unsigned int json_indent_level;
>> +
>> +static const char *json_indent[] = {
>> +       "",
>> +       "\t",
>> +       "\t\t",
>> +       "\t\t\t",
>> +       "\t\t\t\t",
>> +       "\t\t\t\t\t",
>> +};
>> +
>> +#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0]))
>> +
>> +static unsigned int json_prev_struct_members;
>> +static unsigned int json_struct_members;
>> +
>> +static void
>> +json_open_struct(const char *name)
>> +{
>> +       assert(json_indent_level < ARRAY_SIZE(json_indent));
>> +
>> +       json_prev_struct_members = json_struct_members;
>> +       json_struct_members = 0;
>> +
>> +       if (name)
>> +               printf("%s%s\"%s\": {\n",
>> +                      json_prev_struct_members ? ",\n" : "",
>> +                      json_indent[json_indent_level],
> 
> "%*s", json_indent_level, "\t\t\t\t\t"
> didn't stick?

No, I lost patience trying to make it do what I want. AFAIR it insisted 
on right justifying and the negative count also did not work.

> I could follow the flow, dug into a few of the details, and only have
> some nits. One thing, could we feed in a perf record? I was thinking for
> testing the various output modes with known data, but may also be useful
> for replay.

Could do, should be too hard. Writing tests for tool output though 
sounds like something I won't have time to do in the near future.

> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>

Thanks, I'll keep it when I fix the asprintf return value inspection 
which I butchered in a hasty copy and paste work.

Regards,

Tvrtko
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2019-02-11 17:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-11 11:45 [igt-dev] [IGT 1/2] tools/intel_gpu_top: Add support for stdout logging Tvrtko Ursulin
2019-02-11 11:45 ` [igt-dev] [IGT 2/2] tools/intel_gpu_top: Add file output capability Tvrtko Ursulin
2019-02-11 12:12 ` [igt-dev] ✓ Fi.CI.BAT: success for series starting with [1/2] tools/intel_gpu_top: Add support for stdout logging Patchwork
2019-02-11 12:21 ` [igt-dev] [IGT 1/2] " Chris Wilson
2019-02-11 17:08   ` Tvrtko Ursulin [this message]
2019-02-11 14:09 ` [igt-dev] ✓ Fi.CI.IGT: success for series starting with [1/2] " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2556be5-7a01-6e39-a218-3808bb7935f5@linux.intel.com \
    --to=tvrtko.ursulin@linux.intel.com \
    --cc=3.14pi@ukr.net \
    --cc=Intel-gfx@lists.freedesktop.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=eero.t.tamminen@intel.com \
    --cc=igt-dev@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox