forked from btraceio/btrace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbtracer.bat
More file actions
114 lines (102 loc) · 2.81 KB
/
Copy pathbtracer.bat
File metadata and controls
114 lines (102 loc) · 2.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
@echo off
rem %~dp0 is expanded pathname of the current script under NT
set DEFAULT_BTRACE_HOME=%~dp0..
if "%BTRACE_HOME%"=="" set BTRACE_HOME=%DEFAULT_BTRACE_HOME%
set DEFAULT_BTRACE_HOME=
if not exist "%BTRACE_HOME%\build\btrace-agent.jar" goto noBTraceHome
set OPTIONS=
if "%1"=="" (
call:usage
goto end
)
if "%JAVA_HOME%" == "" goto noJavaHome
if "%1" == "--version" (
%JAVA_HOME%\bin\java -jar %BTRACE_HOME%/build/btrace-client.jar com.sun.btrace.Main --version
goto end
)
set inloop=1
:loop
IF "%1"=="-v" (
set OPTIONS="debug=true,%OPTIONS"
goto next
)
IF "%1"=="-u" (
set OPTIONS="unsafe=true,%OPTIONS"
goto next
)
if "%1"=="-p" (
set OPTIONS="port=%2,%OPTIONS"
shift
goto next
)
if "%1"=="-d" (
set OPTIONS="dumpClasses=true,dumpDir=%2,%OPTIONS"
shift
goto next
)
if "%1"=="-o" (
set OPTIONS="scriptOutputFile=%2,%OPTIONS"
shift
goto next
)
if "%1"=="-pd" (
set OPTIONS="probeDescPath=%2,%OPTIONS"
shift
goto next
)
if "%1"=="-bcp" (
OPTIONS="bootClassPath=%2,%OPTIONS"
shift
goto next
)
if "%1"=="-scp" (
set OPTIONS="systemClassPath=%2,%OPTIONS"
shift
goto next
)
if "%1"=="--noserver" (
set OPTIONS="noServer=true,%OPTIONS"
goto next
)
if "%1"=="--stdout" (
set OPTIONS="stdout=true,%OPTIONS"
goto next
)
if "%1"=="-statsd" (
set OPTIONS="statsd=%2,%OPTIONS"
goto next
)
if "%1"=="-h" (
call :usage
goto end
)
set inloop=0
:next
if %inloop==1 (
shift
goto loop
)
%JAVA_HOME%\bin\java -Xshare:off "-javaagent:%BTRACE_HOME%/build/btrace-agent.jar=%OPTIONS,script=%~1" %2 %3 %4 %5 %6 %7 %8 %9
goto end
:noJavaHome
echo Please set JAVA_HOME before running this script
goto end
:noBTraceHome
echo Please set BTRACE_HOME before running this script
goto end
:usage
echo btracer ^<options^> ^<compiled script^> ^<java args^>
echo Options:
echo -v Run in verbose mode
echo -u Run in unsafe mode
echo -p ^<port^> BTrace agent server port
echo -statsd ^<host[:port]^> Use this StatsD server
echo -o ^<file^> The path to a file the btrace agent will store its output
echo -d ^<path^> Dump modified classes to the provided location
echo -pd ^<path^> Search for the probe XML descriptors here
echo --noserver Don't start the socket server
echo --stdout Redirect the btrace output to stdout instead of writing it to an arbitrary file
echo -bcp ^<cp^> Append to bootstrap class path
echo -scp ^<cp^> Append to system class path
echo -h This message
:end