Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make derivation build durations available #7658

Open
lf- opened this issue Jan 22, 2023 · 3 comments
Open

Make derivation build durations available #7658

lf- opened this issue Jan 22, 2023 · 3 comments
Labels
feature Feature request or proposal

Comments

@lf-
Copy link
Member

lf- commented Jan 22, 2023

Is your feature request related to a problem? Please describe.
I am trying to determine whether my friend is having an exceptionally slow build of man-cache, but I can't get the data to compare, since Nix doesn't store the build times.

Describe the solution you'd like
I would like to be able to query the Nix database to find out how long some build of some derivation took, similar to how nix log can get the logs.

Describe alternatives you've considered
Run hydra locally? not practical.

Additional context

Priorities

Add 👍 to issues you find important.

@lf- lf- added the feature Feature request or proposal label Jan 22, 2023
@tomberek
Copy link
Contributor

The Nix DB has registration time, though i don't believe it is used anywhere. While possible to put this into the DB, it does not seem to be the right place for it to go.

Workarounds

A bit hacky, but these have worked for me to discover the time.

function buildTime(){
    drvPath="$1"
    drv=${drvPath##"/nix/store/"}
    echo $(stat "/nix/var/log/nix/drvs/${drv:0:2}/${drv:2}.bz2" -t | awk '{print $14 - $15}' ) ; }

You can also ask Hydra with this:

curl --silent -H "Accept: application/json" https://hydra.nixos.org/build/400143 | jq '.stoptime - .starttime'

@lf-
Copy link
Member Author

lf- commented Jan 23, 2023

oh, is that how this works? interesting. we should add a command line thing to do this as well

@lf- lf- changed the title Persist the total build times of derivations in the database Make derivation build durations available Jan 23, 2023
@Kha
Copy link
Contributor

Kha commented Jan 24, 2023

I didn't know that either, would be an interesting option for https://github.com/Kha/nixprof

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature request or proposal
Projects
None yet
Development

No branches or pull requests

3 participants