diff options
author | Johannes M Dieterich <jmd@FreeBSD.org> | 2017-04-01 17:58:59 +0000 |
---|---|---|
committer | Johannes M Dieterich <jmd@FreeBSD.org> | 2017-04-01 17:58:59 +0000 |
commit | a77376a1fe451c084c5ec703fca0433d3651b578 (patch) | |
tree | 4abd33c67d210df1e8d6d75aa4eb516b942b13c4 /java/lightweight-java-profiler/files | |
parent | Add DOCS OPTION (diff) |
new port: java/lightweight-java-profiler
A port of the lightweight-java-profiler (ljp). ljp acts as a bare-bones agentlib to produce profiling stacks that can be digested, e.g., by Brendan Gregg's flamegraph scripts.
Reviewed by: mat, swills (mentor)
Approved by: swills (mentor)
Differential Revision: https://reviews.freebsd.org/D10194
Notes
Notes:
svn path=/head/; revision=437452
Diffstat (limited to 'java/lightweight-java-profiler/files')
4 files changed, 95 insertions, 0 deletions
diff --git a/java/lightweight-java-profiler/files/patch-Makefile b/java/lightweight-java-profiler/files/patch-Makefile new file mode 100644 index 000000000000..d492da56611c --- /dev/null +++ b/java/lightweight-java-profiler/files/patch-Makefile @@ -0,0 +1,41 @@ +--- Makefile.orig 2017-03-31 01:58:22 UTC ++++ Makefile +@@ -1,7 +1,7 @@ +-SHELL:=/bin/bash ++SHELL:=/usr/bin/env bash + UNAME:=$(shell uname | tr '[A-Z]' '[a-z]') + +-BITS?=32 ++#BITS?=32 + ifeq ($(UNAME), darwin) + READLINK_ARGS:="" + PLATFORM_WARNINGS:=-Weverything -Wno-c++98-compat-pedantic -Wno-padded \ +@@ -23,6 +23,13 @@ else ifeq ($(UNAME), linux) + HEADERS:=include + CC=g++ + LDFLAGS=-Wl,--fatal-warnings ++else ifeq ($(UNAME), freebsd) ++ READLINK_ARGS:="" ++ PLATFORM_WARNINGS:=-Weverything -Wno-c++98-compat-pedantic -Wno-padded \ ++ -Wno-missing-prototypes ++ PLATFORM_COPTS:=-std=c++11 ++ HEADERS:=include ++ LDFLAGS=-Wl,-fatal_warnings + endif + + JAVA_HOME := $(shell \ +@@ -32,11 +39,11 @@ JAVA_HOME := $(shell \ + [[ -n "$${JAVA_HOME}" ]] || (echo "Cannot find JAVA_HOME" && exit) ; \ + echo $${JAVA_HOME}) + AGENT=liblagent.so +-LIBS=-ldl +-BUILD_DIR ?= $(shell mkdir build-$(BITS) 2> /dev/null ; echo build-$(BITS)) ++LIBS=-lc ++BUILD_DIR ?= $(shell mkdir build 2> /dev/null ; echo build) + SRC_DIR:=${PWD}/src + OPT?=-O2 +-GLOBAL_WARNINGS=-Wall -Werror -Wformat-security -Wno-char-subscripts \ ++GLOBAL_WARNINGS=-Wall -Wformat-security -Wno-char-subscripts \ + -Wno-sign-compare -Wno-strict-overflow -Wwrite-strings -Wnon-virtual-dtor \ + -Woverloaded-virtual + GLOBAL_COPTS=-fdiagnostics-show-option -fno-exceptions \ diff --git a/java/lightweight-java-profiler/files/patch-src_display.cc b/java/lightweight-java-profiler/files/patch-src_display.cc new file mode 100644 index 000000000000..b01d0400482b --- /dev/null +++ b/java/lightweight-java-profiler/files/patch-src_display.cc @@ -0,0 +1,11 @@ +--- src/display.cc.orig 2015-04-15 08:00:23 UTC ++++ src/display.cc +@@ -20,7 +20,7 @@ void StackTracesPrinter::PrintStackTrace + if (traces[i].count != 0) { + total += traces[i].count; + count++; +- fprintf(file_, "%"PRIdPTR" ", traces[i].count); ++ fprintf(file_, "%" PRIdPTR" ", traces[i].count); + PrintStackTrace(&traces[i]); + fprintf(file_, "\n"); + } diff --git a/java/lightweight-java-profiler/files/patch-src_entry.cc b/java/lightweight-java-profiler/files/patch-src_entry.cc new file mode 100644 index 000000000000..f70fbbc63406 --- /dev/null +++ b/java/lightweight-java-profiler/files/patch-src_entry.cc @@ -0,0 +1,20 @@ +--- src/entry.cc.orig 2015-04-15 08:00:23 UTC ++++ src/entry.cc +@@ -182,7 +182,7 @@ static void SetFileFromOption(char *equa + if (Globals::OutFile == NULL) { + fprintf(stderr, "Could not open file %s: ", file_name); + perror(NULL); +- exit(1); ++ _exit(1); + } + } + +@@ -207,7 +207,7 @@ static void ParseArguments(char *options + char path[PATH_MAX]; + if (getcwd(path, PATH_MAX) == NULL) { + fprintf(stderr, "cwd too long?\n"); +- exit(0); ++ _exit(0); + } + size_t pathlen = strlen(path); + strncat(path, "/", PATH_MAX - (pathlen++)); diff --git a/java/lightweight-java-profiler/files/patch-src_globals.h b/java/lightweight-java-profiler/files/patch-src_globals.h new file mode 100644 index 000000000000..fd9eb3a9e977 --- /dev/null +++ b/java/lightweight-java-profiler/files/patch-src_globals.h @@ -0,0 +1,23 @@ +--- src/globals.h.orig 2015-04-15 08:00:23 UTC ++++ src/globals.h +@@ -179,18 +179,13 @@ class Accessors { + #endif + }; + +-#if defined(__GNUC__) && (defined(i386) || defined(__x86_64)) + #if defined(__x86_64__) + #define __CAS_INSTR "lock; cmpxchgq %1,%2" + #define __ADD_INSTR "lock; xaddq %0,%1" +-#else // defined(__x86_64__) ++#else + #define __CAS_INSTR "lock; cmpxchgl %1,%2" + #define __ADD_INSTR "lock; xaddl %0,%1" +-#endif // defined(__x86_64__) +-#else // defined(__GNUC__) && (defined(i386) || defined(__x86_64)) +-#error \ +- "Cannot compile with non-x86. Add support for atomic ops, if you want it" +-#endif // defined(__GNUC__) && (defined(i386) || defined(__x86_64)) ++#endif + + inline intptr_t NoBarrier_CompareAndSwap(volatile intptr_t *ptr, + intptr_t old_value, |