2016-03-24 16:36:26 +00:00
|
|
|
{ nixpkgs, pkgs }:
|
|
|
|
|
|
|
|
with pkgs;
|
|
|
|
|
|
|
|
runCommand "nixpkgs-metrics"
|
|
|
|
{ buildInputs = [ nix time ];
|
2018-07-30 09:45:35 +01:00
|
|
|
requiredSystemFeatures = [ "benchmark" ];
|
2016-03-24 16:36:26 +00:00
|
|
|
}
|
|
|
|
''
|
|
|
|
export NIX_DB_DIR=$TMPDIR
|
|
|
|
export NIX_STATE_DIR=$TMPDIR
|
|
|
|
nix-store --init
|
|
|
|
|
|
|
|
mkdir -p $out/nix-support
|
2016-03-24 17:06:46 +00:00
|
|
|
touch $out/nix-support/hydra-build-products
|
2016-03-24 16:36:26 +00:00
|
|
|
|
|
|
|
run() {
|
|
|
|
local name="$1"
|
|
|
|
shift
|
|
|
|
|
|
|
|
echo "running $@"
|
2017-11-25 06:07:27 +00:00
|
|
|
NIX_SHOW_STATS=1 time "$@" 2>&1 > /dev/null | tee stats
|
2016-03-24 16:36:26 +00:00
|
|
|
|
|
|
|
cat stats
|
|
|
|
|
|
|
|
x=$(sed -e 's/.*time elapsed: \([0-9\.]\+\).*/\1/ ; t ; d' stats)
|
|
|
|
[[ -n $x ]] || exit 1
|
|
|
|
echo "$name.time $x s" >> $out/nix-support/hydra-metrics
|
|
|
|
|
|
|
|
x=$(sed -e 's/.* \([0-9]\+\)maxresident.*/\1/ ; t ; d' stats)
|
|
|
|
[[ -n $x ]] || exit 1
|
|
|
|
echo "$name.maxresident $x KiB" >> $out/nix-support/hydra-metrics
|
|
|
|
|
|
|
|
x=$(sed -e 's/.*total allocations: \([0-9]\+\) bytes.*/\1/ ; t ; d' stats)
|
|
|
|
[[ -n $x ]] || exit 1
|
|
|
|
echo "$name.allocations $x B" >> $out/nix-support/hydra-metrics
|
|
|
|
|
2018-03-13 18:29:15 +00:00
|
|
|
x=$(sed -e 's/.*values allocated count: \([0-9]\+\).*/\1/ ; t ; d' stats)
|
2016-03-24 16:36:26 +00:00
|
|
|
[[ -n $x ]] || exit 1
|
|
|
|
echo "$name.values $x" >> $out/nix-support/hydra-metrics
|
|
|
|
}
|
|
|
|
|
2017-11-25 06:07:27 +00:00
|
|
|
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
|
2016-03-24 16:36:26 +00:00
|
|
|
run nix-env.qa nix-env -f ${nixpkgs} -qa
|
|
|
|
run nix-env.qaDrv nix-env -f ${nixpkgs} -qa --drv-path --meta --xml
|
|
|
|
|
2018-08-18 17:38:14 +01:00
|
|
|
num=$(nix-env -f ${nixpkgs} -qa | wc -l)
|
|
|
|
echo "nix-env.qaCount $num" >> $out/nix-support/hydra-metrics
|
|
|
|
|
2016-03-24 16:36:26 +00:00
|
|
|
export GC_INITIAL_HEAP_SIZE=128k
|
|
|
|
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)
|
|
|
|
echo "loc $lines" >> $out/nix-support/hydra-metrics
|
|
|
|
''
|