From 9f90659aa7d246f45b7d52ccc8c45044b26e55fe Mon Sep 17 00:00:00 2001 From: iarspider Date: Fri, 2 Apr 2021 15:41:58 +0200 Subject: igprof: new package (#22666) --- .../builtin/packages/igprof/igprof-5.9.16.patch | 131 +++++++++++++++++++++ var/spack/repos/builtin/packages/igprof/package.py | 34 ++++++ 2 files changed, 165 insertions(+) create mode 100644 var/spack/repos/builtin/packages/igprof/igprof-5.9.16.patch create mode 100644 var/spack/repos/builtin/packages/igprof/package.py diff --git a/var/spack/repos/builtin/packages/igprof/igprof-5.9.16.patch b/var/spack/repos/builtin/packages/igprof/igprof-5.9.16.patch new file mode 100644 index 0000000000..d82310c9d3 --- /dev/null +++ b/var/spack/repos/builtin/packages/igprof/igprof-5.9.16.patch @@ -0,0 +1,131 @@ +--- src/analyse.cc.orig 2016-07-11 14:17:56.000000001 +0200 ++++ src/analyse.cc 2016-07-11 14:20:55.000000001 +0200 +@@ -4374,8 +4374,8 @@ + else + puts(","); + +- printf("[%d, %d, %d, %"PRId64", %"PRId64", %"PRId64", %"PRId64", " +- "%"PRId64", %"PRId64", %"PRId64", ", ++ printf("[%d, %d, %d, %" PRId64 ", %" PRId64 ", %" PRId64 ", %" PRId64 ", " ++ "%" PRId64 ", %" PRId64 ", %" PRId64 ", ", + mainRow.rank(), symbolIndex, fileIndex, + mainRow.SELF, mainRow.CUM, mainRow.KIDS, + mainRow.SELF_ALL[1], mainRow.CUM_ALL[1], +@@ -4445,7 +4445,7 @@ + first = false; + else + puts(","); +- printf("[%d, %d, %"PRId64", %"PRId64", %"PRId64", ", ++ printf("[%d, %d, %" PRId64 ", %" PRId64 ", %" PRId64 ", ", + mainRow.rank(), row.rank(), + row.SELF_COUNTS, row.SELF_CALLS, row.SELF_PATHS); + +@@ -4472,7 +4472,7 @@ + first = false; + else + puts(","); +- printf("[%d, %d, %"PRId64", %"PRId64", %"PRId64", ", ++ printf("[%d, %d, %" PRId64 ", %" PRId64 ", %" PRId64 ", ", + mainRow.rank(), row.rank(), + row.SELF_COUNTS, row.SELF_CALLS, row.SELF_PATHS); + +--- src/buffer.cc.orig 2017-05-31 11:53:55.891358442 +0200 ++++ src/buffer.cc 2017-05-31 11:55:03.519291624 +0200 +@@ -62,12 +62,11 @@ + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); + if (data != MAP_FAILED) + return data; +- else +- { +- igprof_debug("failed to allocate memory for profile buffer: %s (%d)\n", +- strerror(errno), errno); +- igprof_abort(); +- } ++ ++ igprof_debug("failed to allocate memory for profile buffer: %s (%d)\n", ++ strerror(errno), errno); ++ igprof_abort(); ++ __builtin_unreachable(); + } + + void + +--- src/profile-perf.cc.orig 2018-07-11 15:11:31.000000001 +0200 ++++ src/profile-perf.cc 2018-07-11 15:13:07.000000001 +0200 +@@ -98,7 +98,7 @@ + + struct sigaction sa; + sigemptyset(&sa.sa_mask); +- sa.sa_handler = (sighandler_t) &profileSignalHandler; ++ sa.sa_sigaction = &profileSignalHandler; + sa.sa_flags = SA_RESTART | SA_SIGINFO; + sigaction(s_signal, &sa, 0); + } +@@ -252,13 +252,13 @@ + struct sigaction sa; + if (signum == s_signal + && act +- && act->sa_handler != (sighandler_t) &profileSignalHandler) ++ && act->sa_sigaction != &profileSignalHandler) + { + igprof_debug("sigaction(): prevented profiling signal" + " %d from being overridden in thread 0x%lx\n", + s_signal, (unsigned long) pthread_self()); + sigemptyset(&sa.sa_mask); +- sa.sa_handler = (sighandler_t) &profileSignalHandler; ++ sa.sa_sigaction = &profileSignalHandler; + sa.sa_flags = SA_RESTART | SA_SIGINFO; + act = &sa; + } + +--- src/profile-energy.cc.orig 2018-07-11 15:14:32.000000001 +0200 ++++ src/profile-energy.cc 2018-07-11 15:16:56.000000001 +0200 +@@ -268,7 +268,7 @@ + + struct sigaction sa; + sigemptyset(&sa.sa_mask); +- sa.sa_handler = (sighandler_t) &profileSignalHandler; ++ sa.sa_sigaction = &profileSignalHandler; + sa.sa_flags = SA_RESTART | SA_SIGINFO; + sigaction(s_signal, &sa, 0); + } +@@ -415,13 +415,13 @@ + struct sigaction sa; + if (signum == s_signal + && act +- && act->sa_handler != (sighandler_t) &profileSignalHandler) ++ && act->sa_sigaction != &profileSignalHandler) + { + igprof_debug("sigaction(): prevented profiling signal" + " %d from being overridden in thread 0x%lx\n", + s_signal, (unsigned long) pthread_self()); + sigemptyset(&sa.sa_mask); +- sa.sa_handler = (sighandler_t) &profileSignalHandler; ++ sa.sa_sigaction = &profileSignalHandler; + sa.sa_flags = SA_RESTART | SA_SIGINFO; + act = &sa; + } + +--- src/profile.cc.orig 2018-07-13 12:03:48.000000001 +0200 ++++ src/profile.cc 2018-07-11 15:08:49.000000001 +0200 +@@ -577,7 +577,7 @@ + igprof_debug("profiler options: %s\n", options); + + // Report override function use. +- if (igprof_abort != &abort) ++ if ((void (*)())igprof_abort != (void (*)()) &abort) + igprof_debug("abort() from system %p, app had %p\n", + __extension__ (void *) igprof_abort, + __extension__ (void *) &abort); + +--- CMakeLists.txt.orig 2015-10-12 18:36:10.000000000 +0200 ++++ CMakeLists.txt 2021-03-31 10:06:59.776974100 +0200 +@@ -80,7 +80,7 @@ + SET(CMAKE_C_FLAGS "${CMAKE_ANSI_FLAGS} ${CMAKE_C_FLAGS}") + SET(CMAKE_REQUIRED_FLAGS ${CMAKE_ANSI_FLAGS}) + IF(CMAKE_COMPILER_IS_GNUCC) +- ADD_DEFINITIONS(-ansi -pedantic -W -Wall -Wno-long-long -Werror) ++ ADD_DEFINITIONS(-ansi -pedantic -W -Wall -Wno-long-long) + ENDIF() + + IF(UNIX) diff --git a/var/spack/repos/builtin/packages/igprof/package.py b/var/spack/repos/builtin/packages/igprof/package.py new file mode 100644 index 0000000000..560ea32e74 --- /dev/null +++ b/var/spack/repos/builtin/packages/igprof/package.py @@ -0,0 +1,34 @@ +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Igprof(CMakePackage): + """IgProf (the Ignominous Profiler) is a simple nice tool for measuring and + analysing application memory and performance characteristics. + + IgProf requires no changes to the application or the build process. It + currently works on Linux (ia32, x86_64).""" + + homepage = "https://igprof.org/" + url = "https://github.com/igprof/igprof/archive/v5.9.16.tar.gz" + + version('5.9.16', sha256='cc977466b310f47bbc2967a0bb6ecd49d7437089598346e3f1d8aaf9a7555d96') + + depends_on('libunwind') + + # Three patches in one: C++11 compatibility (src/analyse.cc), + # libunwind "compatibility" (remove -Werror in CMakeLists.txt) - + # see also https://github.com/spack/spack/pull/21537, + # and gcc 8.x compatibility (the rest of the changes). + # Adopted from LCGCMake https://gitlab.cern.ch/sft/lcgcmake + patch('igprof-5.9.16.patch', when='@5.9.16', level=0) + + def build_system_flags(pkg, name, flags): + if name == 'cxxflags': + flags.extend(('-Wno-unused-variable', '-Wno-error=unused-result')) + + return (None, None, flags) -- cgit v1.2.3-60-g2f50