Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
suspend time accounts into merge time
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
krotuss
Apprentice
Apprentice


Joined: 01 Aug 2008
Posts: 239

PostPosted: Wed May 01, 2024 10:12 pm    Post subject: suspend time accounts into merge time Reply with quote

Hi, when I put my computer into S3 sleep while running emerge, I get high "current merge time" reported by genlop because it accounts when computer is in sleep. Can this be configured? I would like to account only time when computer is actually "running".
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1912

PostPosted: Wed May 01, 2024 11:06 pm    Post subject: Reply with quote

genlop is a log reader. It simply subtracts the start timestamp from the end timestamp. The log does not have consideration for sleep.
Back to top
View user's profile Send private message
krotuss
Apprentice
Apprentice


Joined: 01 Aug 2008
Posts: 239

PostPosted: Thu May 02, 2024 7:14 pm    Post subject: Reply with quote

Was it ever put under consideration to provide more representative time(s)? Eg. it wasn't implemented because of limited dev resources or because nobody requested it?
Back to top
View user's profile Send private message
grknight
Retired Dev
Retired Dev


Joined: 20 Feb 2015
Posts: 1912

PostPosted: Thu May 02, 2024 8:21 pm    Post subject: Reply with quote

The log for a build looks like this (emerge.log):
Code:
1714671956:  >>> emerge (62 of 62) sys-boot/grub-2.12-r4 to /
1714671956:  === (62 of 62) Cleaning (sys-boot/grub-2.12-r4::/var/repo/portage/sys-boot/grub/grub-2.12-r4.ebuild)
1714671957:  === (62 of 62) Compiling/Merging (sys-boot/grub-2.12-r4::/var/repo/portage/sys-boot/grub/grub-2.12-r4.ebuild)
1714672227:  === (62 of 62) Merging (sys-boot/grub-2.12-r4::/var/repo/portage/sys-boot/grub/grub-2.12-r4.ebuild)
1714672238:  >>> AUTOCLEAN: sys-boot/grub:2
1714672238:  === Unmerging... (sys-boot/grub-2.12-r2)
1714672240:  >>> unmerge success: sys-boot/grub-2.12-r2
1714672243:  === (62 of 62) Post-Build Cleaning (sys-boot/grub-2.12-r4::/var/repo/portage/sys-boot/grub/grub-2.12-r4.ebuild)
1714672243:  ::: completed emerge (62 of 62) sys-boot/grub-2.12-r4 to /
If you have a better method/format, then file a bug to change emerge. Remember that the log must support async entries since multiple jobs can write intertwined.
Back to top
View user's profile Send private message
krotuss
Apprentice
Apprentice


Joined: 01 Aug 2008
Posts: 239

PostPosted: Thu May 02, 2024 8:38 pm    Post subject: Reply with quote

It could output something like:

Code:

1714672243:  ::: completed emerge (62 of 62) sys-boot/grub-2.12-r4 to /; merge time: 123; user 456; system 789; whatever...
Back to top
View user's profile Send private message
szatox
Advocate
Advocate


Joined: 27 Aug 2013
Posts: 3426

PostPosted: Thu May 02, 2024 11:08 pm    Post subject: Reply with quote

I don't know how it is actually handled in portage, but standard logging utilities can actually handle timestamps for you, which is very convenient.
You can try e.g. calling something like
logger "my message"
On my system this alone is enough for "my message" to appear in /var/log/everything/current, along with timestamp and tagged with my username.

Doing full accounting of consumed resources would require emerge to actually request accounting data from kernel and explicitly send them to logs, which is a bit of extra work not really related to managing packages AKA going out if its way to provide additional reporting which may or may not be useful.
Note that this data is inherently unreliable anyway, so getting more accurate historic reports won't let you make better predictions. It is always going to be a rough estimation, like the order of magnitude. Like, "am I going to wait for a duration of a sandwich, a walk, or do should I just come back tomorrow?"
_________________
Make Computing Fun Again
Back to top
View user's profile Send private message
Genone
Retired Dev
Retired Dev


Joined: 14 Mar 2003
Posts: 9608
Location: beyond the rim

PostPosted: Fri May 03, 2024 7:57 am    Post subject: Reply with quote

krotuss wrote:
Was it ever put under consideration to provide more representative time(s)? Eg. it wasn't implemented because of limited dev resources or because nobody requested it?

Both.

krotuss wrote:
It could output something like:

Code:

1714672243:  ::: completed emerge (62 of 62) sys-boot/grub-2.12-r4 to /; merge time: 123; user 456; system 789; whatever...


Formatting the data isn't the problem, obtaining it is. As building/merging a package isn't just a simple process call but a mix of python and bash code with various subprocesses you can't just copy how bash is doing it with the time builtin (which asks the kernel for resource usage of a single child process, so you can't use it for actual bash code). In particular if you consider edge cases like resumed builds.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum