All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arjan van de Ven <arjan at linux.intel.com>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH 4/4] Add support for Intel GPU statistics
Date: Sun, 05 Aug 2012 10:37:51 -0700	[thread overview]
Message-ID: <501EAF6F.3020106@linux.intel.com> (raw)
In-Reply-To: 20120805173244.GA3199@swordfish

[-- Attachment #1: Type: text/plain, Size: 1673 bytes --]

>>
>> +	file.open("/sys/class/drm/card0/power/rc6_residency_ms",  ios::in);
>> +
>> +	if (file) {
>> +		handle_i965_gpu();
>> +		file.close();
>> +	}
>> +
> 
> side note: just wonder how much C++ stream with its heavy buffering, etc. is slower
> than stat(). I'll review and if it makes sense will probably prepare simple stat()
> wrapper to lib.cpp

better to use access() than stat.

both have the fun of getting a bunch of low level system headers into C++
I'm sure that'll work most of the time, but for something as non-time critical as this
I wonder how badly that is inviting trouble.




>> +	
>> +	if (line_nr == 0)
>> +		d = 100.0 - ratio * (rc6_after + rc6p_after + rc6pp_after - rc6_before - rc6p_before - rc6pp_before);
>> +	if (line_nr == 1)
>> +		d = ratio * (rc6_after - rc6_before);
>> +	if (line_nr == 2)
>> +		d = ratio * (rc6p_after - rc6p_before);
>> +	if (line_nr == 3)
>> +		d = ratio * (rc6pp_after - rc6pp_before);
>> +	if (line_nr >= 4 || line_nr < 0)
>> +		return buffer;
>> +
> 
> small side note /* someone will do it anyway :-) */:
> how about
> 
> 	if (line_nr == 0)
> 		d = 100.0 - ratio * (rc6_after + rc6p_after + rc6pp_after - rc6_before - rc6p_before - rc6pp_before);
> 	else if (line_nr == 1)
> 		d = ratio * (rc6_after - rc6_before);
> 	else if (line_nr == 2)
> 		d = ratio * (rc6p_after - rc6p_before);
> 	else if (line_nr == 3)
> 		d = ratio * (rc6pp_after - rc6pp_before);
> 	else if (line_nr >= 4 || line_nr < 0)
> 		return buffer;

well last time I looked at the disassembly for such a case, this generated worse code.
I'll admit that that was about 2 gcc versions ago though.


             reply	other threads:[~2012-08-05 17:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-05 17:37 Arjan van de Ven [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-05 18:02 [Powertop] [PATCH 4/4] Add support for Intel GPU statistics Sergey Senozhatsky
2012-08-05 17:32 Sergey Senozhatsky
2012-08-05 17:14 Arjan van de Ven

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=501EAF6F.3020106@linux.intel.com \
    --to=powertop@lists.01.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.