about summary refs log tree commit diff
path: root/pkgs/development/tools/profiling
diff options
context:
space:
mode:
authorSymphorien Gibol <symphorien+git@xlumurb.eu>2018-12-02 13:16:36 +0100
committerSymphorien Gibol <symphorien+git@xlumurb.eu>2018-12-03 23:27:33 +0100
commit330fbbeb7399bb6d18d0fd317b68d5a56cd03ae8 (patch)
treed2d8f3c418808e54a56eae345d421020b9baad59 /pkgs/development/tools/profiling
parent7041972128a5192640fada3abe38b4ae1cf8b99c (diff)
downloadnixlib-330fbbeb7399bb6d18d0fd317b68d5a56cd03ae8.tar
nixlib-330fbbeb7399bb6d18d0fd317b68d5a56cd03ae8.tar.gz
nixlib-330fbbeb7399bb6d18d0fd317b68d5a56cd03ae8.tar.bz2
nixlib-330fbbeb7399bb6d18d0fd317b68d5a56cd03ae8.tar.lz
nixlib-330fbbeb7399bb6d18d0fd317b68d5a56cd03ae8.tar.xz
nixlib-330fbbeb7399bb6d18d0fd317b68d5a56cd03ae8.tar.zst
nixlib-330fbbeb7399bb6d18d0fd317b68d5a56cd03ae8.zip
pyflame: init at 1.6.7
Diffstat (limited to 'pkgs/development/tools/profiling')
-rw-r--r--pkgs/development/tools/profiling/pyflame/default.nix57
1 files changed, 57 insertions, 0 deletions
diff --git a/pkgs/development/tools/profiling/pyflame/default.nix b/pkgs/development/tools/profiling/pyflame/default.nix
new file mode 100644
index 000000000000..31ecbcaacbf0
--- /dev/null
+++ b/pkgs/development/tools/profiling/pyflame/default.nix
@@ -0,0 +1,57 @@
+{ stdenv, fetchFromGitHub, autoreconfHook, coreutils, pkgconfig
+# pyflame needs one python version per ABI
+# are currently supported 
+# * 2.6 or 2.7 for 2.x ABI
+# * 3.4 or 3.5 for 3.{4,5} ABI
+# * 3.6        for 3.6+ ABI
+# if you want to disable support for some ABI, make the corresponding argument null
+, python2, python35, python36
+}:
+stdenv.mkDerivation rec {
+  pname = "pyflame";
+  version = "1.6.7"; 
+  src = fetchFromGitHub {
+    owner = "uber";
+    repo = "pyflame";
+    rev = "v${version}";
+    sha256 = "0hz1ryimh0w8zyxx4y8chcn54d6b02spflj5k9rcg26an2chkg2w";
+  };
+
+  nativeBuildInputs = [ autoreconfHook pkgconfig ];
+  buildInputs = [ python36 python2 python35 ];
+
+  postPatch = ''
+    patchShebangs .
+    # some tests will fail in the sandbox
+    substituteInPlace tests/test_end_to_end.py \
+      --replace 'skipif(IS_DOCKER' 'skipif(True'
+  '';
+
+  doCheck = true;
+  # reproduces the logic of their test script, but without downloading pytest
+  # from the internet with pip
+  checkPhase = with stdenv.lib; concatMapStringsSep "\n" (python: ''
+    set -x
+    PYMAJORVERSION=${head (strings.stringToCharacters python.version)} \
+      PATH=${makeBinPath [ coreutils ]}\
+      PYTHONPATH= \
+      ${python.pkgs.pytest}/bin/pytest tests/
+    set +x
+  '') (filter (x: x!=null) buildInputs);
+
+  meta = with stdenv.lib; {
+    description = "A ptracing profiler for Python ";
+    longDescription = ''
+      Pyflame is a high performance profiling tool that generates flame graphs for
+      Python. Pyflame uses the Linux ptrace(2) system call to collect profiling
+      information. It can take snapshots of the Python call stack without
+      explicit instrumentation, meaning you can profile a program without
+      modifying its source code.
+    '';
+    homepage = https://github.com/uber/pyflame;
+    license = licenses.asl20;
+    maintainers = [ maintainers.symphorien ];
+    # arm: https://github.com/uber/pyflame/issues/136
+    platforms = [ "i686-linux" "x86_64-linux" ];
+  };
+}