projects/guix·blob javascript-team · refs

615 lines · 24.6 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2017 Dave Love <[email protected]>
3;;; Copyright © 2018, 2019, 2020 Tobias Geerinckx-Rice <[email protected]>
4;;; Copyright © 2022 Ludovic Courtès <[email protected]>
5;;; Copyright © 2023 dan <[email protected]>
6;;; Copyright © 2025 Luca Cirrottola <[email protected]>
7;;; Copyright © 2025, 2026 Artyom V. Poptsov <[email protected]>
8;;; Copyright © 2026 Cayetano Santos <[email protected]>
9;;; Copyright @ 2026 Johannes Elsing <[email protected]>
10;;;
11;;; This file is part of GNU Guix.
12;;;
13;;; GNU Guix is free software; you can redistribute it and/or modify it
14;;; under the terms of the GNU General Public License as published by
15;;; the Free Software Foundation; either version 3 of the License, or (at
16;;; your option) any later version.
17;;;
18;;; GNU Guix is distributed in the hope that it will be useful, but
19;;; WITHOUT ANY WARRANTY; without even the implied warranty of
20;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21;;; GNU General Public License for more details.
22;;;
23;;; You should have received a copy of the GNU General Public License
24;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25
26(define-module (gnu packages profiling)
27 #:use-module (guix packages)
28 #:use-module (guix gexp)
29 #:use-module (guix git-download)
30 #:use-module ((guix licenses) #:prefix license:) ; avoid zlib, expat clashes
31 #:use-module (guix download)
32 #:use-module (guix utils)
33 #:use-module (guix build-system cmake)
34 #:use-module (guix build-system gnu)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages autotools)
37 #:use-module (gnu packages base) ;for "which"
38 #:use-module (gnu packages bash) ;for "which"
39 #:use-module (gnu packages build-tools)
40 #:use-module (gnu packages bison)
41 #:use-module (gnu packages compression)
42 #:use-module (gnu packages documentation)
43 #:use-module (gnu packages engineering)
44 #:use-module (gnu packages fabric-management)
45 #:use-module (gnu packages compiler-tools)
46 #:use-module (gnu packages fontutils)
47 #:use-module (gnu packages freedesktop)
48 #:use-module (gnu packages gawk)
49 #:use-module (gnu packages gcc)
50 #:use-module (gnu packages gl)
51 #:use-module (gnu packages glib)
52 #:use-module (gnu packages haskell-xyz)
53 #:use-module (gnu packages libunwind)
54 #:use-module (gnu packages linux)
55 #:use-module (gnu packages llvm)
56 #:use-module (gnu packages mpi)
57 #:use-module (gnu packages ncurses)
58 #:use-module (gnu packages perl)
59 #:use-module (gnu packages protobuf)
60 #:use-module (gnu packages pkg-config)
61 #:use-module (gnu packages python)
62 #:use-module (gnu packages qt)
63 #:use-module (gnu packages xdisorg))
64
65;; Fixme: Separate out lib and fix resulting cycle errors; separate libpfm
66;; output(?); build libmsr and add that component.
67(define-public papi
68 (package
69 (name "papi")
70 (version "6.0.0.1")
71 (source
72 (origin
73 (method url-fetch)
74 (uri (string-append "https://icl.utk.edu/projects/papi/downloads/papi-"
75 version ".tar.gz"))
76 (sha256
77 (base32 "0zr83v51lp4ijgk997dz9fpph48prlsbml26dvb223avqr8fvmrw"))
78 (modules '((guix build utils)))
79 (snippet
80 '(begin
81 ;; Remove bundled software.
82 (for-each delete-file-recursively
83 '("src/libpfm-3.y" "src/libpfm4"
84 "src/perfctr-2.6.x"
85 "src/perfctr-2.7.x"))
86
87 ;; Adjust include directives.
88 (substitute* "src/components/lmsensors/linux-lmsensors.c"
89 (("<sensors.h>")
90 "<sensors/sensors.h>"))))))
91 (build-system gnu-build-system)
92 (inputs
93 (list ncurses
94 rdma-core
95 libpfm4
96 `(,lm-sensors "lib")
97 `(,infiniband-diags "lib")
98 net-tools))
99 (native-inputs
100 (list gcc-13
101 gfortran-13))
102 (arguments
103 (list #:tests? #f ;no check target
104 #:configure-flags
105 ;; These are roughly per Fedora, but elide mx (assumed to be dead, even
106 ;; Open-MX) and add and powercap -- I don't know the pros/cons of
107 ;; infiniband and infiniband_mad, but you can't use them together, and
108 ;; the umad version needs at least one patch.
109 ;; Implicit enabled components: perf_event perf_event_uncore
110 #~`("--with-perf-events" "--with-shared-lib=yes" "--with-shlib"
111 "--with-static-lib=no" "--with-shlib-tools"
112 "--with-components=appio coretemp example lustre micpower net rapl \
113stealtime lmsensors infiniband powercap"
114 ;; So utils get rpath set correctly:
115 ,(string-append "LDFLAGS=-Xlinker -rpath -Xlinker "
116 #$output "/lib")
117 ,(string-append "--with-pfm-prefix="
118 #$(this-package-input "libpfm4")))
119
120 #:phases
121 #~(modify-phases %standard-phases
122 (add-after 'unpack 'change-directory
123 (lambda _
124 (chdir "src")
125
126 ;; Work around a mistake whereby 'configure' would always error
127 ;; out when passing '--with-static-lib=no'.
128 (substitute* "configure"
129 (("test \"\\$static_lib\" = \"no\"")
130 "false"))))
131 (add-after 'install 'extra-doc
132 (lambda* (#:key outputs #:allow-other-keys)
133 (let ((doc (string-append (assoc-ref outputs "out")
134 "/share/doc/"
135 #$name "-" #$version)))
136 (chdir "..") ; we went into src above
137 (for-each (lambda (file)
138 (install-file file doc))
139 '("README.md" "RELEASENOTES.txt"))))))))
140 (home-page "https://icl.utk.edu/papi/")
141 (synopsis "Performance Application Programming Interface")
142 (description
143 "PAPI provides the tool designer and application engineer with a consistent
144interface and methodology for use of the performance counter hardware found in
145most major microprocessors. PAPI enables software engineers to see, in near
146real time, the relation between software performance and processor events.
147
148In addition, PAPI provides access to a collection of components that expose
149performance measurement opportunities across the hardware and software stack.")
150 (properties
151 '((release-monitoring-url
152 . "http://icl.cs.utk.edu/papi/software/")))
153 ;; See Debian papi copyright file.
154 (license (list license:bsd-3
155 license:lgpl2.1+ ;src/components/infiniband/pscanf.h
156 ;; not used in output
157 license:gpl2+ ;src/components/appio/tests/iozone/gengnuplot.sh
158 ))))
159
160(define-public ittapi
161 (package
162 (name "ittapi")
163 (version "3.28.2")
164 (source
165 (origin
166 (method git-fetch)
167 (uri (git-reference
168 (url "https://github.com/intel/ittapi/")
169 (commit (string-append "v" version))))
170 (file-name (git-file-name name version))
171 (sha256
172 (base32
173 "089q50ma8g3qxyxv37w3g8yxlpxah94lv06bi4r0l4p5v6w8a365"))))
174 (build-system cmake-build-system)
175 (arguments
176 (list
177 #:tests? #f ;there are no tests
178 #:configure-flags #~(list "-DITT_API_IPT_SUPPORT=ON")))
179 (native-inputs
180 (list python-minimal-wrapper))
181 (home-page
182 "https://github.com/intel/ittapi/")
183 (synopsis "Intel instrumentation and tracing APIs")
184 (description
185 "This package provides the Intel @acronym{ITT, Instrumentation and
186Tracing Technology} and @acronym{JIT, Just-In-Time} profiling APIs, to
187generate and control the collection of trace data during program execution.")
188 (license license:gpl2)))
189
190;; NB. there's a potential name clash with libotf.
191(define-public otf2
192 (package
193 (name "otf2")
194 (version "3.2")
195 (source
196 (origin
197 (method url-fetch)
198 (uri (string-append "https://perftools.pages.jsc.fz-juelich.de/cicd/otf2/tags/otf2-"
199 version "/otf2-" version ".tar.gz"))
200 (sha256 (base32 "13aasqqf9ddlf4j4hxwr412zkfnw5jlfqigxr37c7f0can5aicw2"))))
201 (properties
202 ;; Tell the 'generic-html' updater to monitor this URL for updates.
203 `((release-monitoring-url
204 . "https://perftools.pages.jsc.fz-juelich.de/cicd/otf2/")))
205 (native-inputs (list python))
206 (outputs '("doc" ; 21MB
207 "lib"
208 "out"))
209 (build-system gnu-build-system)
210 (arguments
211 `(#:configure-flags '("--enable-shared" "--disable-static")
212 #:phases
213 (modify-phases %standard-phases
214 (add-after 'unpack 'normalize-pkgconfig-files-location
215 (lambda _
216 ;; Prevent lib/pkgconfig/otf2-backend.pc from referencing the
217 ;; prefix of output "out" from the "lib" store location.
218 (substitute* "otf2-build.pc.in"
219 (("^prefix=.*") "")
220 (("^exec_prefix=.*") ""))))
221 (add-after 'install 'licence
222 (lambda* (#:key outputs #:allow-other-keys)
223 (for-each (lambda (output)
224 (let ((doc (string-append (assoc-ref outputs output)
225 "/share/doc/otf2")))
226 (install-file "COPYING" doc)))
227 '("lib" "doc"))
228 #t)))))
229 (home-page "https://www.vi-hps.org/projects/score-p/")
230 (synopsis "Open Trace Format 2 library")
231 (description "The Open Trace Format 2 (@dfn{OTF2}) is a scalable,
232memory-efficient event trace data format plus support library.")
233 (license license:bsd-3)))
234
235(define-public opari2
236 (package
237 (name "opari2")
238 (version "2.0.9")
239 (source
240 (origin
241 (method url-fetch)
242 (uri (string-append "https://perftools.pages.jsc.fz-juelich.de/cicd/opari2/tags/opari2-"
243 version "/opari2-" version ".tar.gz"))
244 (sha256
245 (base32 "0yfpzxy70wp6mwi6pvvc9a6bkaal14yysiddmvx6lrn5azvkjwfm"))))
246 (build-system gnu-build-system)
247 (inputs (list gfortran))
248 (native-inputs (list gawk ; for tests
249 which))
250 (home-page "https://www.vi-hps.org/projects/score-p")
251 (synopsis "OpenMP runtime performance measurement instrumenter")
252 (description "OPARI2 is a source-to-source instrumentation tool for OpenMP
253and hybrid codes. It surrounds OpenMP directives and runtime library calls
254with calls to the POMP2 measurement interface.")
255 (license license:bsd-3)))
256
257;; Since version 4.4, CUBE has been split in three different packages: CubeW,
258;; CubeLib, CubeGUI. They are still released together, so we conventionally
259;; define cubew as the parent package for cubelib and cubegui to factorize
260;; common data.
261(define-public cubew
262 (package
263 (name "cubew")
264 (version "4.9")
265 (source
266 (origin
267 (method url-fetch)
268 (uri
269 (string-append "https://apps.fz-juelich.de/scalasca/releases/cube/"
270 version "/dist/cubew-"
271 version ".tar.gz"))
272 (sha256
273 (base32 "1pdcs8688y4nwcxshgs9773xmdajxahsbjsrfh8m7gv9qn0lxxsf"))))
274 (build-system gnu-build-system)
275 (arguments
276 (list
277 #:configure-flags
278 #~(list "--enable-shared" "--disable-static" "--disable-silent-rules"
279 (string-append "--with-frontend-zlib="
280 #$(this-package-input "zlib") "/lib")
281 (string-append "--with-backend-zlib="
282 #$(this-package-input "zlib") "/lib"))))
283 (inputs
284 (list zlib))
285 (home-page "https://www.scalasca.org/software/cube-4.x/download.html")
286 (synopsis "CUBE high performance C writer library")
287 (description
288 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
289of performance metrics for parallel programs including MPI and OpenMP
290applications. CubeW is the high performance C writer library of the CUBE
291project.")
292 (license license:bsd-3)))
293
294(define-public cubelib
295 (package/inherit cubew
296 (name "cubelib")
297 (source
298 (origin
299 (method url-fetch)
300 (uri
301 (string-append "https://apps.fz-juelich.de/scalasca/releases/cube/"
302 (package-version cubew) "/dist/cubelib-"
303 (package-version cubew) ".tar.gz"))
304 (sha256
305 (base32 "0hwl0aihn6fgpl0qhqckxc3sslb78wq6xav5ykfgfjzpyddqyrd0"))))
306 (arguments
307 (substitute-keyword-arguments arguments
308 ((#:configure-flags flags)
309 #~(append #$flags
310 (list "--with-compression=full")))
311 ((#:parallel-tests? _ #f) #f)))
312 (inputs
313 (list zlib))
314 (synopsis "CUBE C++ profile library")
315 (description
316 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
317of performance metrics for parallel programs including MPI and OpenMP
318applications. CubeLib is the general purpose C++ library and tool of the CUBE
319project.")))
320
321(define-public cubegui
322 (package/inherit cubew
323 (name "cubegui")
324 (source
325 (origin
326 (method url-fetch)
327 (uri
328 (string-append "https://apps.fz-juelich.de/scalasca/releases/cube/"
329 (package-version cubew) "/dist/cubegui-"
330 (package-version cubew) ".tar.gz"))
331 (sha256
332 (base32 "04byhf00xnn1ppca914ag4hq2kjv37lhwyh8dl369ps47mp6viqh"))))
333 (arguments
334 (list
335 #:configure-flags
336 #~(list "--enable-shared" "--disable-static" "--disable-silent-rules"
337 (string-append "CXXFLAGS=-I" #$(this-package-input "dbus")
338 "/include/dbus-1.0")
339 (string-append "LDFLAGS=-L" #$(this-package-input "dbus")
340 "/lib"))))
341 (native-inputs
342 (list qtbase))
343 (inputs
344 (list cubelib
345 dbus
346 perl))
347 (synopsis "CUBE profile explorer GUI")
348 (description
349 "CUBE (CUBE Uniform Behavioral Encoding) is a tool to display a variety
350of performance metrics for parallel programs including MPI and OpenMP
351applications. CubeGUI is the graphical explorer of the CUBE project.")))
352
353(define-public tracy-wayland
354 (package
355 (name "tracy-wayland")
356 (version "0.10")
357 (source
358 (origin
359 (method git-fetch)
360 (uri (git-reference
361 (url "https://github.com/wolfpld/tracy")
362 (commit (string-append "v" version))))
363 (sha256
364 (base32
365 "1w50bckvs1nn68amzrkyrh769dhmlhk7w00kr8ac5h9ryk349p8c"))
366 (file-name (git-file-name "tracy" version))
367 (modules '((guix build utils)))
368 (snippet
369 '(begin
370 ;; XXX: Sadly, the ImGui loaders appear to have been customized by
371 ;; the project and the build fails when using the 'imgui' Guix
372 ;; package due to a missing GL_TEXTURE_WRAP_S definition, so keep
373 ;; the bundled copy.
374
375 ;; Unbundle Zstd.
376 (delete-file-recursively "zstd")
377 ;; Adjust the include directives.
378 (substitute* (find-files "server" "\\.(c|h)pp$")
379 (("#include \".*zstd/(zstd|zdict).h\"" _ header)
380 (format #f "#include \"~a.h\"" header)))
381 ;; De-register source files from Visual Code project.
382 (substitute* "profiler/build/win32/Tracy.vcxproj"
383 ((".*Include=\"..\\\\..\\\\..\\\\zstd\\\\.*") ""))))))
384 ;; Note: There is also CMake and Meson support, but only to build the
385 ;; tracy library, not the profiler command.
386 (build-system gnu-build-system)
387 (arguments
388 (list
389 #:tests? #f ;no test for the profiler
390 #:make-flags
391 #~(list (string-append "CC=" #$(cc-for-target))
392 (string-append "CFLAGS=-lzstd"))
393 #:phases
394 #~(modify-phases %standard-phases
395 (add-before 'build 'chdir
396 (lambda _
397 (chdir "profiler/build/unix")))
398 (delete 'configure) ;the profiler has no configure script
399 (replace 'install
400 (lambda _
401 (let ((bin (string-append #$output "/bin"))
402 (tracy (string-append #$output "/bin/tracy")))
403 (mkdir-p bin)
404 (copy-file "Tracy-release" tracy)))))))
405 (inputs (list capstone
406 dbus
407 freetype
408 libxkbcommon
409 mesa
410 wayland
411 `(,zstd "lib")))
412 (native-inputs (list gcc-13 pkg-config))
413 (home-page "https://github.com/wolfpld/tracy")
414 (synopsis "Frame profiler")
415 (description
416 "A real time, nanosecond resolution, remote telemetry, hybrid frame and
417sampling profiler for games and other applications.")
418 (license license:bsd-3)))
419
420(define-public tracy
421 (package;xb
422 (inherit tracy-wayland)
423 (name "tracy")
424 (arguments
425 (substitute-keyword-arguments arguments
426 ((#:make-flags flags #~'())
427 #~(append #$flags
428 ;; The LEGACY flag indicate we want to build tracy with glfw.
429 (list "LEGACY=1")))))
430 (inputs (modify-inputs inputs
431 (delete "libxkbcommon" "wayland")
432 (prepend glfw)))
433 (synopsis "Frame profiler (X11 version)")))
434
435(define-public scalasca
436 (package
437 (name "scalasca")
438 (version "2.6.2")
439 (source
440 (origin
441 (method url-fetch)
442 (uri (string-append
443 "https://apps.fz-juelich.de/scalasca/releases/scalasca/"
444 (version-major+minor version) "/dist/scalasca-" version
445 ".tar.gz"))
446 (sha256
447 (base32
448 "18022bzdlzdgngcc5zlmsakvsk9dfg14kvg4ancqfhxy13cjzrqp"))
449 ;; Remove bundled dependencies that can be replaced by inputs
450 (snippet
451 #~(begin
452 (use-modules (guix build utils))
453 (delete-file-recursively "vendor/cubew/")
454 (delete-file-recursively "vendor/otf2/")))))
455 (properties
456 ;; Tell the 'generic-html' updater to monitor this URL for updates.
457 `((release-monitoring-url
458 . "https://perftools.pages.jsc.fz-juelich.de/cicd/scalasca")))
459 (build-system gnu-build-system)
460 (arguments
461 (list
462 #:configure-flags
463 #~(list "--enable-shared" "--disable-static")
464 #:phases
465 #~(modify-phases %standard-phases
466 (add-after 'install 'wrap-scripts
467 ;; Use wrap-program on some outputs to resolve runtime dependency
468 ;; on coreutils, sed... without propagating these inputs.
469 (lambda* (#:key outputs #:allow-other-keys)
470 (with-directory-excursion
471 (string-append #$output "/bin")
472 (for-each
473 (lambda (file)
474 (wrap-program file
475 `("PATH" ":" prefix ,(search-path-as-string->list
476 (getenv "PATH")))))
477 (list "scalasca" "skin" "square"))))))))
478 (inputs
479 (list openmpi
480 cubew
481 otf2
482 zlib
483 libiberty
484 which ; configure and runtime dependency
485 findutils ; runtime dependency
486 gawk ; runtime dependency
487 scorep-openmpi ; runtime dependency
488 cubelib ; otherwise "ERROR: cube_dump is not available!"
489 cubegui ; needed at runtime
490 bash-minimal)) ; needed for using "wrap-program" in the recipe
491 (home-page "https://scalasca.org")
492 (synopsis "Performance analysis of parallel programs through runtime
493measurements")
494 (description
495 "Scalasca targets mainly scientific and engineering applications based on
496the programming interfaces MPI and OpenMP, including hybrid applications based
497on a combination of the two. Unlike Scalasca 1.x, the Scalasca 2.x release
498series is based on the community instrumentation and measurement infrastructure
499Score-P. This significantly improves interoperability with other performance
500analysis tool suites such as Vampir and TAU due to the usage of the two common
501data formats CUBE4 for profiles and the Open Trace Format 2 (OTF2) for event
502trace data.")
503 (license license:bsd-3)))
504
505(define-public perfetto
506 (package
507 (name "perfetto")
508 (version "53.0")
509 (source (origin
510 (method git-fetch)
511 (uri (git-reference
512 (url "https://github.com/google/perfetto")
513 (commit (string-append "v" version))))
514 (file-name (git-file-name name version))
515 (sha256
516 (base32
517 "1g2r90348pl173r3wp9k5546sdgan3pdw0002bqicaw028j3gq96"))
518 (modules '((guix build utils)))
519 (snippet
520 #~(for-each (lambda (name)
521 (unless (string-suffix? "trigger.pzc.h" name)
522 (delete-file name)))
523 (find-files "." "\\.pzc")))))
524 (build-system gnu-build-system)
525 (arguments
526 (list
527 #:phases
528 #~(modify-phases %standard-phases
529 (add-after 'unpack 'build-documentation
530 (lambda _
531 (invoke "pandoc" "docs/reference/perfetto-cli.md"
532 "--standalone" "-t" "man"
533 "-o" "perfetto.1")))
534 (add-after 'build-documentation 'remove-origin-rpath
535 (lambda _
536 (substitute* "gn/standalone/BUILD.gn"
537 ((".*-rpath=.*ORIGIN.*") ""))))
538 (replace 'configure
539 (lambda _
540 (invoke "gn" "gen"
541 (string-append
542 "--args="
543 "is_debug=false"
544 " perfetto_use_pkgconfig=true"
545 " perfetto_use_system_protobuf=true"
546 " perfetto_use_system_zlib=true"
547 " use_custom_libcxx=false"
548 " skip_buildtools_check=true"
549 " is_hermetic_clang=false"
550 " is_system_compiler=true"
551 " is_clang=false"
552 (string-append " extra_ldflags=\""
553 "-Wl,-rpath=" #$output "/lib\""))
554 "out/linux")))
555 (replace 'build
556 (lambda* (#:key parallel-build? #:allow-other-keys)
557 (invoke "ninja" "-j"
558 (number->string (if parallel-build?
559 (parallel-job-count)
560 1))
561 "-C" "out/linux"
562 "perfetto"
563 "protozero_c_plugin" ; for gen_c_protos
564 "tracebox"
565 "traced"
566 "traced_probes")))
567 (add-after 'build 'generate-headers
568 (lambda _
569 (substitute* "tools/gen_c_protos"
570 ((".*call.*ninja.*") "")
571 (("def protoc_path.*")
572 "def protoc_path(_):\n return 'protoc'\n")
573 ((".*path.*clang-format not found.*")
574 " 'BUILD.gn')\n path='clang-format'\n"))
575 (invoke "tools/gen_c_protos" "out/linux")))
576 (delete 'check)
577 (replace 'install
578 (lambda _
579 (let ((bin (string-append #$output "/bin"))
580 (include (string-append #$output "/include"))
581 (lib (string-append #$output "/lib"))
582 (doc (string-append #$output "/share/man/man1")))
583 (mkdir-p bin)
584 (mkdir-p include)
585 (mkdir-p lib)
586 (mkdir-p doc)
587 (copy-recursively "include/perfetto"
588 (string-append include "/perfetto"))
589 (for-each delete-file
590 (filter (lambda (name)
591 (or (string=? "README.md" name)
592 (string=? "BUILD.gn" name)))
593 (find-files include)))
594 (install-file "out/linux/libperfetto.so" lib)
595 (install-file "out/linux/traced" bin)
596 (install-file "out/linux/traced_probes" bin)
597 (install-file "out/linux/perfetto" bin)
598 (install-file "out/linux/tracebox" bin)
599 (install-file "perfetto.1" doc)))))))
600 (native-inputs
601 (list clang-21 ; for clang-format used by gen_c_protos
602 gn
603 ninja
604 pandoc
605 pkg-config
606 protobuf
607 python-minimal-wrapper))
608 (inputs (list zlib))
609 (home-page "https://perfetto.dev/")
610 (synopsis "Framework for client-side tracing and profiling")
611 (description "Perfetto is a framework for performance instrumentation and
612trace analysis. This package contains the library, the @code{traced} and
613@code{traced_probes} daemons as well as the @code{perfetto} command-line
614interface.")
615 (license license:asl2.0)))