GNU bug report logs - #41150
[PATCH] gnu: Add powerstat.

Previous Next

Package: guix-patches;

Reported by: Tobias Geerinckx-Rice <me <at> tobias.gr>

Date: Sat, 9 May 2020 15:16:02 UTC

Severity: normal

Tags: patch

Done: Tobias Geerinckx-Rice <me <at> tobias.gr>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 41150 in the body.
You can then email your comments to 41150 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 15:16:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tobias Geerinckx-Rice <me <at> tobias.gr>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 09 May 2020 15:16:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: guix-patches <at> gnu.org
Subject: [PATCH] gnu: Add powerstat.
Date: Sat,  9 May 2020 17:15:09 +0200
* gnu/packages/linux.scm (powerstat): New public variable.
---
 gnu/packages/linux.scm | 44 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm
index d2bffe8d8c..0d558f0277 100644
--- a/gnu/packages/linux.scm
+++ b/gnu/packages/linux.scm
@@ -1195,7 +1195,50 @@ at login.  Local and dynamic reconfiguration are its key features.")
 ;;; Miscellaneous.
 ;;;
 
+(define-public powerstat
+  (package
+    (name "powerstat")
+    (version "0.02.22")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append "https://kernel.ubuntu.com/~cking/tarballs/"
+                           "powerstat/powerstat-" version ".tar.gz"))
+       (sha256
+        (base32 "0r355b9syqa2nhfy8ksvxyy5d58v0isf983842js091s6liy0x7g"))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:make-flags
+       (list "CC=gcc"
+             (string-append "prefix=" (assoc-ref %outputs "out")))
+       #:tests? #f                      ; no test suite
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'respect-$prefix
+           ;; https://bugs.launchpad.net/ubuntu/+source/powerstat/+bug/1877744
+           (lambda _
+             (substitute* "Makefile"
+               (("DIR=/usr/") "DIR=$(prefix)/"))
+             #t))
+         (delete 'configure))))         ; no configure script
+    (home-page "https://kernel.ubuntu.com/~cking/powerstat/")
+    (synopsis "Measure system power consumption")
+    (description
+     "Powerstat measures and reports your computer's power consumption in real
+time.  On mobile PCs, it uses ACPI battery information to measure the power
+drain of the entire system.
+
+Powerstat can also report @acronym{RAPL, Running Average Power Limit} power
+domain measurements.  These are available only on some hardware such as Intel
+Sandybridge and newer, and cover only part of the machine's components such as
+CPU, DRAM, and graphics.  However, they provide accurate and immediate readings
+and don't require a battery at all.
+
+The output is like @command{vmstat} but also shows power consumption statistics:
+at the end of a run, @command{powerstat} will calculate the average, standard
+deviation, and minimum and maximum values.  It can show a nice histogram too.")
+    (license license:gpl2)))
+
 (define-public psmisc
   (package
     (name "psmisc")
-- 
2.26.2





Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 17:19:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: Tobias Geerinckx-Rice via Guix-patches via <guix-patches <at> gnu.org>
Cc: 41150 <at> debbugs.gnu.org, Tobias Geerinckx-Rice <me <at> tobias.gr>
Subject: Re: [bug#41150] [PATCH] gnu: Add powerstat.
Date: Sat, 09 May 2020 19:01:40 +0200
Hey Tobias,

> +    (arguments
> +     `(#:make-flags
> +       (list "CC=gcc"

Hard-coding CC this way will prevent cross-compilation. You can have a
look to "crda" or "libaio" for examples.

As this is a recurring pattern, we should find a way to add it somewhere
in the build-system. But for now, the ugly snippet appending target
should work :).

Otherwise this looks fine!

Thanks,

Mathieu




Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 17:19:03 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 17:33:01 GMT) Full text and rfc822 format available.

Message #14 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 41150 <at> debbugs.gnu.org,
 Tobias Geerinckx-Rice via Guix-patches via <guix-patches <at> gnu.org>
Subject: Re: [bug#41150] [PATCH] gnu: Add powerstat.
Date: Sat, 09 May 2020 19:32:15 +0200
[Message part 1 (text/plain, inline)]
Mathieu,

Mathieu Othacehe 写道:
> Hard-coding CC this way will prevent cross-compilation. You can 
> have a
> look to "crda" or "libaio" for examples.

Eh?  This is the first time anyone's ever mentioned that.  Thanks! 
It's obvious how much cross-compilation means to me.

(You realise there are *hundreds* of CC=gcc lines in current Guix, 
right?)

Don't get me wrong: I love that Guix still cares so much about 
cross-compilation, and the tremendous effort I see in the logs 
every month to make it work better, when (at least a few years 
ago) it was all the rage to declare it dead since VMs exist or 
something.

> As this is a recurring pattern, we should find a way to add it 
> somewhere
> in the build-system. But for now, the ugly snippet appending 
> target
> should work :).

I agree that handling (only) standard GNU variables[0] in the GNU 
build system makes sense.

I'll add the snippet of power.

Kind regards,

T G-R

[0]: 
https://www.gnu.org/prep/standards/standards.html#Utilities-in-Makefiles
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 17:33:02 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 20:04:02 GMT) Full text and rfc822 format available.

Message #20 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Jean-Baptiste Note <jean-baptiste.note <at> m4x.org>
To: Tobias Geerinckx-Rice via Guix-patches via <guix-patches <at> gnu.org>
Cc: Mathieu Othacehe <othacehe <at> gnu.org>, 41150 <at> debbugs.gnu.org,
 Tobias Geerinckx-Rice <me <at> tobias.gr>
Subject: Re: [bug#41150] [PATCH] gnu: Add powerstat.
Date: Sat, 09 May 2020 20:03:48 +0000
Hi there,

There are actually more than 300 such instances, and counting...

Couldn't we get a "magic" variable %target-cc like we have
%output, %outputs -- then we could just stubstitute gcc for this
variable...

I would do it, if I only knew where these are defined, but my scheme
skills are definitely lacking :)

Kind regards,
Jean-Baptiste




Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 20:04:02 GMT) Full text and rfc822 format available.

Reply sent to Tobias Geerinckx-Rice <me <at> tobias.gr>:
You have taken responsibility. (Sat, 09 May 2020 20:43:01 GMT) Full text and rfc822 format available.

Notification sent to Tobias Geerinckx-Rice <me <at> tobias.gr>:
bug acknowledged by developer. (Sat, 09 May 2020 20:43:01 GMT) Full text and rfc822 format available.

Message #28 received at 41150-done <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Mathieu Othacehe <othacehe <at> gnu.org>
Cc: 41150-done <at> debbugs.gnu.org
Subject: Re: [bug#41150] [PATCH] gnu: Add powerstat.
Date: Sat, 09 May 2020 22:42:25 +0200
[Message part 1 (text/plain, inline)]
Mathieu again,

Mathieu Othacehe 写道:
> Hard-coding CC this way will prevent cross-compilation. You can 
> have a
> look to "crda" or "libaio" for examples.

Do you happen to know why libaio specifies the full path to gcc 
(only) when cross-compiling?  I didn't bother modifying it to 
test.

I cross-built powerstat for aarch64 on my laptop (then ran it by 
accident -- modern GNU/Linux is mad).  I'm not restricting 
platforms (yet) since my knowledge of ACPI support outside of x86 
does not exist.

Pushed as 510a8eb1b8b4f2686606e427b8965c126b81ed8a.

Thanks!

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 21:05:01 GMT) Full text and rfc822 format available.

Message #31 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Jean-Baptiste Note <jean-baptiste.note <at> m4x.org>
Cc: Mathieu Othacehe <othacehe <at> gnu.org>, 41150 <at> debbugs.gnu.org,
 Tobias Geerinckx-Rice via Guix-patches via <guix-patches <at> gnu.org>
Subject: Re: [bug#41150] [PATCH] gnu: Add powerstat.
Date: Sat, 09 May 2020 23:04:08 +0200
[Message part 1 (text/plain, inline)]
Jean-Baptiste!

Jean-Baptiste Note 写道:
> There are actually more than 300 such instances

*Hundreds*! :-p

On a positive note there are 3 fewer occurences on c-u (308) than 
master (311).

I used a simple ‘grep CC=gcc | wc -l’; I suspect you did something 
similar.

> and counting...

It shouldn't increase if people posts their patches for review 
(...and they actually get reviewed...).  CC=gcc is an old habit 
but not difficult to break.

> Couldn't we get a "magic" variable %target-cc like we have
> %output, %outputs -- then we could just stubstitute gcc for this
> variable...

I'm (not yet?) (no longer?) convinced that's a good idea once 
gnu-build-system takes care of those 308 packages and we're left 
with the exceptions.

When I replied to Mathieu's last mail I hadn't looked at the code 
yet:

 (let ((target ,(%current-target-system)))
   (list (string-append "CC=" (if target
                                  (string-append target "-gcc")
                                  "gcc"))))

To me, abstracting that is beyond overkill.

However, I don't know much about cross-compiling.  TBH I'd be 
sowewhat surprised if none of the CROSS-* procedures I regularly 
scroll past do something like this already.

> I would do it, if I only knew where these are defined, but my 
> scheme
> skills are definitely lacking :)

Mainly (gnu packages cross-base).

Kind regards,

T G-R, currently building kernels to properly answer your 
hibernation mails...
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 21:05:01 GMT) Full text and rfc822 format available.

Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sat, 09 May 2020 21:11:01 GMT) Full text and rfc822 format available.

Message #37 received at 41150 <at> debbugs.gnu.org (full text, mbox):

From: Tobias Geerinckx-Rice <me <at> tobias.gr>
To: Jean-Baptiste Note <jean-baptiste.note <at> m4x.org>
Cc: 41150 <at> debbugs.gnu.org
Subject: Re: [bug#41150] [PATCH] gnu: Add powerstat.
Date: Sat, 09 May 2020 23:10:35 +0200
[Message part 1 (text/plain, inline)]
Tobias Geerinckx-Rice 写道:
> Jean-Baptiste Note 写道:
>> I would do it, if I only knew where these are defined, but my 
>> scheme
>> skills are definitely lacking :)
>
> Mainly (gnu packages cross-base).

...or if you mean the % friends: (guix utils).  %target-gcc could 
be computed at evaluation (as opposed to build) time so is 
relatively simple [see previous mail for ‘too simple’ argument].

Kind regards,

T G-R
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#41150; Package guix-patches. (Sun, 10 May 2020 07:25:01 GMT) Full text and rfc822 format available.

Message #40 received at 41150 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <othacehe <at> gnu.org>
To: 41150 <at> debbugs.gnu.org
Cc: me <at> tobias.gr
Subject: Re: bug#41150: [PATCH] gnu: Add powerstat.
Date: Sun, 10 May 2020 09:24:25 +0200
Hey,

> Do you happen to know why libaio specifies the full path to gcc (only) when
> cross-compiling?  I didn't bother modifying it to test.

Just tested, this does not seem useful.

> I cross-built powerstat for aarch64 on my laptop (then ran it by accident --
> modern GNU/Linux is mad).  I'm not restricting platforms (yet) since my
> knowledge of ACPI support outside of x86 does not exist.

It's for sure less common than on x86, but it seems that it exists, see:
https://www.kernel.org/doc/Documentation/arm64/arm-acpi.txt.

> Pushed as 510a8eb1b8b4f2686606e427b8965c126b81ed8a.

Thanks for fixing it :)

Mathieu




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 07 Jun 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 73 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.