Skip to content

Commit 8d4fd18

Browse files
committed
hide clean class names behind dottedclass option
1 parent 50f2eee commit 8d4fd18

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ You can add a comma separated list of options to `perf-java` (or the `AttachOnce
2323

2424
- `unfold`: create extra entries for every codeblock inside a method that was inlined from elsewhere (named <inlined_method> in <root_method>)
2525
- `msig`: include full method signature in the name string
26+
- `dottedclass`: convert class signature (`Ljava/lang/Class;`) to the usual class names with segments separated by dots (`java.lang.Class`). NOTE: this currently breaks coloring when used in combination with [flamegraphs](https://github.com/brendangregg/FlameGraph).
2627

2728
## Disclaimer
2829

perf-map-agent.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
FILE *method_file = NULL;
3333
int unfold_inlined_methods = 0;
3434
int print_method_signatures = 0;
35+
int clean_class_names = 0;
3536

3637
void open_map_file() {
3738
if (!method_file)
@@ -51,7 +52,7 @@ static int get_line_number(jvmtiLineNumberEntry *table, jint entry_count, jlocat
5152
}
5253

5354
void class_name_from_sig(char *dest, size_t dest_size, const char *sig) {
54-
if (sig[0] == 'L') {
55+
if (clean_class_names && sig[0] == 'L') {
5556
char *src = sig + 1;
5657
int i;
5758
for(i = 0; i < (dest_size - 1) && src[i]; i++) {
@@ -205,6 +206,7 @@ Agent_OnAttach(JavaVM *vm, char *options, void *reserved) {
205206

206207
unfold_inlined_methods = strstr(options, "unfold") != NULL;
207208
print_method_signatures = strstr(options, "msig") != NULL;
209+
clean_class_names = strstr(options, "dottedclass") != NULL;
208210

209211
jvmtiEnv *jvmti;
210212
(*vm)->GetEnv(vm, (void **)&jvmti, JVMTI_VERSION_1);

0 commit comments

Comments
 (0)