pkgs/top-level/metrics.nix: tidy up variables and quoting
We also allow the lines to be unbroken.
This commit is contained in:
+26
-27
@@ -40,49 +40,48 @@ stdenvNoCC.mkDerivation {
|
||||
echo "running $@"
|
||||
|
||||
case "$name" in
|
||||
# Redirect stdout to /dev/null to avoid hitting "Output Limit
|
||||
# Exceeded" on Hydra.
|
||||
# Redirect stdout to /dev/null to avoid hitting "Output Limit Exceeded" on Hydra.
|
||||
nix-env.qaDrv|nix-env.qaDrvAggressive)
|
||||
NIX_SHOW_STATS=1 NIX_SHOW_STATS_PATH=stats-nix time -o stats-time "$@" >/dev/null ;;
|
||||
*)
|
||||
NIX_SHOW_STATS=1 NIX_SHOW_STATS_PATH=stats-nix time -o stats-time "$@" ;;
|
||||
esac
|
||||
|
||||
cat stats-nix; echo; cat stats-time; echo
|
||||
# Show the Nix statistics and the `time` statistics.
|
||||
cat stats-nix
|
||||
echo
|
||||
cat stats-time
|
||||
echo
|
||||
|
||||
x=$(jq '.cpuTime' < stats-nix)
|
||||
[[ -n $x ]] || exit 1
|
||||
echo "$name.time $x s" >> $out/nix-support/hydra-metrics
|
||||
cpuTime="$(jq '.cpuTime' < stats-nix)"
|
||||
[[ -n $cpuTime ]] || exit 1
|
||||
echo "$name.time $cpuTime s" >> $out/nix-support/hydra-metrics
|
||||
|
||||
x=$(sed -e 's/.* \([0-9]\+\)maxresident.*/\1/ ; t ; d' < stats-time)
|
||||
[[ -n $x ]] || exit 1
|
||||
echo "$name.maxresident $x KiB" >> $out/nix-support/hydra-metrics
|
||||
maxresident="$(sed -e 's/.* \([0-9]\+\)maxresident.*/\1/ ; t ; d' < stats-time)"
|
||||
[[ -n $maxresident ]] || exit 1
|
||||
echo "$name.maxresident $maxresident KiB" >> $out/nix-support/hydra-metrics
|
||||
|
||||
# nix-2.2 also outputs .symbols.bytes but that wasn't summed originally
|
||||
# https://github.com/NixOS/nix/pull/2392/files#diff-8e6ba8c21672fc1a5f6f606e1e101c74L1762
|
||||
x=$(jq '[.envs,.list,.values,.sets] | map(.bytes) | add' < stats-nix)
|
||||
[[ -n $x ]] || exit 1
|
||||
echo "$name.allocations $x B" >> $out/nix-support/hydra-metrics
|
||||
# Nix also outputs `.symbols.bytes` but since that wasn't summed originally, we don't count it here.
|
||||
allocations="$(jq '[.envs,.list,.values,.sets] | map(.bytes) | add' < stats-nix)"
|
||||
[[ -n $allocations ]] || exit 1
|
||||
echo "$name.allocations $allocations B" >> $out/nix-support/hydra-metrics
|
||||
|
||||
x=$(jq '.values.number' < stats-nix)
|
||||
[[ -n $x ]] || exit 1
|
||||
echo "$name.values $x" >> $out/nix-support/hydra-metrics
|
||||
values="$(jq '.values.number' < stats-nix)"
|
||||
[[ -n $values ]] || exit 1
|
||||
echo "$name.values $values" >> $out/nix-support/hydra-metrics
|
||||
}
|
||||
|
||||
run nixos.smallContainer nix-instantiate --dry-run ${nixpkgs}/nixos/release.nix \
|
||||
-A closures.smallContainer.x86_64-linux --show-trace
|
||||
run nixos.kde nix-instantiate --dry-run ${nixpkgs}/nixos/release.nix \
|
||||
-A closures.kde.x86_64-linux --show-trace
|
||||
run nixos.lapp nix-instantiate --dry-run ${nixpkgs}/nixos/release.nix \
|
||||
-A closures.lapp.x86_64-linux --show-trace
|
||||
run nixos.smallContainer nix-instantiate --dry-run ${nixpkgs}/nixos/release.nix -A closures.smallContainer.x86_64-linux --show-trace
|
||||
run nixos.kde nix-instantiate --dry-run ${nixpkgs}/nixos/release.nix -A closures.kde.x86_64-linux --show-trace
|
||||
run nixos.lapp nix-instantiate --dry-run ${nixpkgs}/nixos/release.nix -A closures.lapp.x86_64-linux --show-trace
|
||||
run nix-env.qa nix-env -f ${nixpkgs} -qa
|
||||
run nix-env.qaDrv nix-env -f ${nixpkgs} -qa --drv-path --meta --xml
|
||||
|
||||
# It's slightly unclear which of the set to track: qaCount, qaCountDrv, qaCountBroken.
|
||||
num=$(nix-env -f ${nixpkgs} -qa | wc -l)
|
||||
num="$(nix-env -f ${nixpkgs} -qa | wc -l)"
|
||||
echo "nix-env.qaCount $num" >> $out/nix-support/hydra-metrics
|
||||
qaCountDrv=$(nix-env -f ${nixpkgs} -qa --drv-path | wc -l)
|
||||
num=$((num - $qaCountDrv))
|
||||
qaCountDrv="$(nix-env -f ${nixpkgs} -qa --drv-path | wc -l)"
|
||||
num="$((num - $qaCountDrv))"
|
||||
echo "nix-env.qaCountBroken $num" >> $out/nix-support/hydra-metrics
|
||||
|
||||
# TODO: this has been ignored for some time
|
||||
@@ -91,7 +90,7 @@ stdenvNoCC.mkDerivation {
|
||||
run nix-env.qaAggressive nix-env -f ${nixpkgs} -qa
|
||||
run nix-env.qaDrvAggressive nix-env -f ${nixpkgs} -qa --drv-path --meta --xml
|
||||
|
||||
lines=$(find ${nixpkgs} -name "*.nix" -type f | xargs cat | wc -l)
|
||||
lines="$(find ${nixpkgs} -name "*.nix" -type f | xargs cat | wc -l)"
|
||||
echo "loc $lines" >> $out/nix-support/hydra-metrics
|
||||
|
||||
runHook postInstall
|
||||
|
||||
Reference in New Issue
Block a user