fork
Configure Feed
Select the types of activity you want to include in your feed.
lol
fork
Configure Feed
Select the types of activity you want to include in your feed.
1{ lib, stdenv, fetchurl, nasm }:
2
3let
4 inherit (stdenv.hostPlatform.parsed.cpu) bits;
5 arch = "bandwidth${toString bits}";
6in
7stdenv.mkDerivation rec {
8 pname = "bandwidth";
9 version = "1.11.2";
10
11 src = fetchurl {
12 url = "https://zsmith.co/archives/${pname}-${version}.tar.gz";
13 sha256 = "sha256-mjtvQAOH9rv12XszGdD5hIX197er7Uc74WfVaP32TpM=";
14 };
15
16 postPatch = ''
17 sed -i 's,ar ,$(AR) ,g' OOC/Makefile
18 # Remove unnecessary -m32 for 32-bit targets
19 sed -i 's,-m32,,g' OOC/Makefile
20 # Replace arm64 with aarch64
21 sed -i 's#,arm64#,aarch64#g' Makefile
22 # Fix wrong comment character
23 sed -i 's,# 32,; 32,g' routines-x86-32bit.asm
24 # Fix missing symbol exports for macOS clang
25 echo global _VectorToVector128 >> routines-x86-64bit.asm
26 echo global _VectorToVector256 >> routines-x86-64bit.asm
27 '';
28
29 nativeBuildInputs = [ nasm ];
30
31 buildFlags = [
32 "AR=${stdenv.cc.targetPrefix}ar"
33 "CC=${stdenv.cc.targetPrefix}cc"
34 "ARM_AS=${stdenv.cc.targetPrefix}as"
35 "ARM_CC=$(CC)"
36 "UNAMEPROC=${stdenv.hostPlatform.parsed.cpu.name}"
37 "UNAMEMACHINE=${stdenv.hostPlatform.parsed.cpu.name}"
38 arch
39 ];
40
41 installPhase = ''
42 mkdir -p $out/bin
43 cp ${arch} $out/bin/bandwidth
44 '';
45
46 meta = with lib; {
47 homepage = "https://zsmith.co/bandwidth.html";
48 description = "Artificial benchmark for identifying weaknesses in the memory subsystem";
49 license = licenses.gpl2Plus;
50 platforms = platforms.x86 ++ platforms.arm ++ platforms.aarch64;
51 maintainers = with maintainers; [ r-burns ];
52 };
53}