Skip to content

Commit 3660d57

Browse files
bric3jbachorik
authored andcommitted
Unify unwinding counters to single counters
1 parent e094330 commit 3660d57

File tree

6 files changed

+37
-39
lines changed

6 files changed

+37
-39
lines changed

ddprof-lib/src/main/cpp/counters.h

+1-3
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,7 @@
6060
X(AGCT_NATIVE_NO_JAVA_CONTEXT, "agct_native_no_java_context") \
6161
X(AGCT_BLOCKED_IN_VM, "agct_blocked_in_vm") \
6262
X(SKIPPED_WALLCLOCK_UNWINDS, "skipped_wallclock_unwinds") \
63-
X(UNWINDING_STUB_TIME, "unwinding_stub_time") \
64-
X(UNWINDING_COMPILED_TIME, "unwinding_compiled_time") \
65-
X(UNWINDING_ATOMIC_STUB_TIME, "unwinding_atomic_stub_time")
63+
X(UNWINDING_TIME, "unwinding_time")
6664
#define X_ENUM(a, b) a,
6765
typedef enum CounterId : int {
6866
DD_COUNTER_TABLE(X_ENUM) DD_NUM_COUNTERS

ddprof-lib/src/main/cpp/stackFrame_aarch64.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
7575
const u64 endTime = TSC::ticks();
7676
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
7777
if (duration > 1) {
78-
Counters::increment(UNWINDING_STUB_TIME, duration);
78+
Counters::increment(UNWINDING_TIME, duration);
7979
}
8080
return true;
8181
} else if (strcmp(name, "forward_copy_longs") == 0 ||
@@ -97,7 +97,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
9797
const u64 endTime = TSC::ticks();
9898
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
9999
if (duration > 1) {
100-
Counters::increment(UNWINDING_STUB_TIME, duration);
100+
Counters::increment(UNWINDING_TIME, duration);
101101
}
102102
return true;
103103
} else if (entry != NULL && entry[0] == 0xa9bf7bfd) {
@@ -111,7 +111,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
111111
const u64 endTime = TSC::ticks();
112112
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
113113
if (duration > 1) {
114-
Counters::increment(UNWINDING_STUB_TIME, duration);
114+
Counters::increment(UNWINDING_TIME, duration);
115115
}
116116
return true;
117117
} else if (entry[1] == 0x910003fd && withinCurrentStack(fp)) {
@@ -122,7 +122,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
122122
const u64 endTime = TSC::ticks();
123123
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
124124
if (duration > 1) {
125-
Counters::increment(UNWINDING_STUB_TIME, duration);
125+
Counters::increment(UNWINDING_TIME, duration);
126126
}
127127
return true;
128128
}
@@ -158,7 +158,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
158158
const u64 endTime = TSC::ticks();
159159
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
160160
if (duration > 1) {
161-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
161+
Counters::increment(UNWINDING_TIME, duration);
162162
}
163163
} else if (ip > entry && ip[0] == 0x910003fd && ip[-1] == 0xa9bf7bfd) {
164164
// stp x29, x30, [sp, #-16]!
@@ -169,7 +169,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
169169
const u64 endTime = TSC::ticks();
170170
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
171171
if (duration > 1) {
172-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
172+
Counters::increment(UNWINDING_TIME, duration);
173173
}
174174
} else if (ip > entry + 3 && !nm->isFrameCompleteAt(ip) &&
175175
(isEntryBarrier(ip) || isEntryBarrier(ip + 1))) {
@@ -181,7 +181,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
181181
const u64 endTime = TSC::ticks();
182182
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
183183
if (duration > 1) {
184-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
184+
Counters::increment(UNWINDING_TIME, duration);
185185
}
186186
} else {
187187
// Just try
@@ -191,7 +191,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
191191
const u64 endTime = TSC::ticks();
192192
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
193193
if (duration > 1) {
194-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
194+
Counters::increment(UNWINDING_TIME, duration);
195195
}
196196
return true;
197197
}
@@ -208,7 +208,7 @@ bool StackFrame::unwindAtomicStub(const void*& pc) {
208208
const u64 endTime = TSC::ticks();
209209
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
210210
if (duration > 1) {
211-
Counters::increment(UNWINDING_ATOMIC_STUB_TIME, duration);
211+
Counters::increment(UNWINDING_TIME, duration);
212212
}
213213
return true;
214214
}
@@ -217,7 +217,7 @@ bool StackFrame::unwindAtomicStub(const void*& pc) {
217217
const u64 endTime = TSC::ticks();
218218
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
219219
if (duration > 1) {
220-
Counters::increment(UNWINDING_ATOMIC_STUB_TIME, duration);
220+
Counters::increment(UNWINDING_TIME, duration);
221221
}
222222
return false;
223223
}

ddprof-lib/src/main/cpp/stackFrame_arm.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,15 +87,15 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
8787
const u64 endTime = TSC::ticks();
8888
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
8989
if (duration > 1) {
90-
Counters::increment(UNWINDING_STUB_TIME, duration);
90+
Counters::increment(UNWINDING_TIME, duration);
9191
}
9292
return true;
9393
}
9494

9595
const u64 endTime = TSC::ticks();
9696
u64 duration = TSC::ticks_to_millis(endTime - startTime);
9797
if (duration > 1) {
98-
Counters::increment(UNWINDING_STUB_TIME, duration);
98+
Counters::increment(UNWINDING_TIME, duration);
9999
}
100100
return false;
101101
}
@@ -116,7 +116,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
116116
const u64 endTime = TSC::ticks();
117117
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
118118
if (duration > 1) {
119-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
119+
Counters::increment(UNWINDING_TIME, duration);
120120
}
121121
return true;
122122
} else if (*ip == 0xe8bd4800) {
@@ -129,7 +129,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
129129
const u64 endTime = TSC::ticks();
130130
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
131131
if (duration > 1) {
132-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
132+
Counters::increment(UNWINDING_TIME, duration);
133133
}
134134
return true;
135135
}
@@ -138,7 +138,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
138138
const u64 endTime = TSC::ticks();
139139
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
140140
if (duration > 1) {
141-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
141+
Counters::increment(UNWINDING_TIME, duration);
142142
}
143143
return true;
144144
}

ddprof-lib/src/main/cpp/stackFrame_i386.cpp

+7-7
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
8282
const u64 endTime = TSC::ticks();
8383
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
8484
if (duration > 1) {
85-
Counters::increment(UNWINDING_STUB_TIME, duration);
85+
Counters::increment(UNWINDING_TIME, duration);
8686
}
8787
return true;
8888
} else if (entry != NULL && entry[0] == 0x55 && entry[1] == 0x8b &&
@@ -97,7 +97,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
9797
const u64 endTime = TSC::ticks();
9898
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
9999
if (duration > 1) {
100-
Counters::increment(UNWINDING_STUB_TIME, duration);
100+
Counters::increment(UNWINDING_TIME, duration);
101101
}
102102
return true;
103103
} else if (withinCurrentStack(fp)) {
@@ -108,7 +108,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
108108
const u64 endTime = TSC::ticks();
109109
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
110110
if (duration > 1) {
111-
Counters::increment(UNWINDING_STUB_TIME, duration);
111+
Counters::increment(UNWINDING_TIME, duration);
112112
}
113113
return true;
114114
}
@@ -117,7 +117,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
117117
const u64 endTime = TSC::ticks();
118118
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
119119
if (duration > 1) {
120-
Counters::increment(UNWINDING_STUB_TIME, duration);
120+
Counters::increment(UNWINDING_TIME, duration);
121121
}
122122
return false;
123123
}
@@ -137,7 +137,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
137137
const u64 endTime = TSC::ticks();
138138
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
139139
if (duration > 1) {
140-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
140+
Counters::increment(UNWINDING_TIME, duration);
141141
}
142142
return true;
143143
} else if (*ip == 0x5d) {
@@ -149,15 +149,15 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
149149
const u64 endTime = TSC::ticks();
150150
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
151151
if (duration > 1) {
152-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
152+
Counters::increment(UNWINDING_TIME, duration);
153153
}
154154
return true;
155155
}
156156

157157
const u64 endTime = TSC::ticks();
158158
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
159159
if (duration > 1) {
160-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
160+
Counters::increment(UNWINDING_TIME, duration);
161161
}
162162
return false;
163163
}

ddprof-lib/src/main/cpp/stackFrame_ppc64.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
121121
const u64 endTime = TSC::ticks();
122122
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
123123
if (duration > 1) {
124-
Counters::increment(UNWINDING_STUB_TIME, duration);
124+
Counters::increment(UNWINDING_TIME, duration);
125125
}
126126
return true;
127127
}
@@ -156,7 +156,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
156156
const u64 endTime = TSC::ticks();
157157
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
158158
if (duration > 1) {
159-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
159+
Counters::increment(UNWINDING_TIME, duration);
160160
}
161161
return true;
162162
}

ddprof-lib/src/main/cpp/stackFrame_x64.cpp

+12-12
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
7676
const u64 endTime = TSC::ticks();
7777
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
7878
if (duration > 1) {
79-
Counters::increment(UNWINDING_STUB_TIME, duration);
79+
Counters::increment(UNWINDING_TIME, duration);
8080
}
8181
return true;
8282
}
8383
if (entry == nullptr) {
8484
const u64 endTime = TSC::ticks();
8585
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
8686
if (duration > 1) {
87-
Counters::increment(UNWINDING_STUB_TIME, duration);
87+
Counters::increment(UNWINDING_TIME, duration);
8888
}
8989
return false;
9090
}
@@ -93,7 +93,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
9393
const u64 endTime = TSC::ticks();
9494
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
9595
if (duration > 1) {
96-
Counters::increment(UNWINDING_STUB_TIME, duration);
96+
Counters::increment(UNWINDING_TIME, duration);
9797
}
9898
return false;
9999
}
@@ -108,7 +108,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
108108
const u64 endTime = TSC::ticks();
109109
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
110110
if (duration > 1) {
111-
Counters::increment(UNWINDING_STUB_TIME, duration);
111+
Counters::increment(UNWINDING_TIME, duration);
112112
}
113113
return true;
114114
} else if (withinCurrentStack(fp)) {
@@ -119,7 +119,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
119119
const u64 endTime = TSC::ticks();
120120
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
121121
if (duration > 1) {
122-
Counters::increment(UNWINDING_STUB_TIME, duration);
122+
Counters::increment(UNWINDING_TIME, duration);
123123
}
124124
return true;
125125
}
@@ -128,7 +128,7 @@ bool StackFrame::unwindStub(instruction_t *entry, const char *name,
128128
const u64 endTime = TSC::ticks();
129129
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
130130
if (duration > 1) {
131-
Counters::increment(UNWINDING_STUB_TIME, duration);
131+
Counters::increment(UNWINDING_TIME, duration);
132132
}
133133
return false;
134134
}
@@ -153,7 +153,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
153153
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
154154
if (duration > 1)
155155
{
156-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
156+
Counters::increment(UNWINDING_TIME, duration);
157157
}
158158
return true;
159159
} else if (*ip == 0x5d) {
@@ -165,7 +165,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
165165
const u64 endTime = TSC::ticks();
166166
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
167167
if (duration > 1) {
168-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
168+
Counters::increment(UNWINDING_TIME, duration);
169169
}
170170
return true;
171171
} else if (ip <= entry + 15 && ((uintptr_t)ip & 0xfff) && ip[-1] == 0x55) {
@@ -176,7 +176,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
176176
const u64 endTime = TSC::ticks();
177177
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
178178
if (duration > 1) {
179-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
179+
Counters::increment(UNWINDING_TIME, duration);
180180
}
181181
return true;
182182
} else if (ip <= entry + 7 && ip[0] == 0x48 && ip[1] == 0x89 &&
@@ -188,7 +188,7 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
188188
const u64 endTime = TSC::ticks();
189189
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
190190
if (duration > 1) {
191-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
191+
Counters::increment(UNWINDING_TIME, duration);
192192
}
193193
return true;
194194
} else if ((ip[0] == 0x41 && ip[1] == 0x81 && ip[2] == 0x7f &&
@@ -204,15 +204,15 @@ bool StackFrame::unwindCompiled(NMethod *nm, uintptr_t &pc, uintptr_t &sp,
204204
const u64 endTime = TSC::ticks();
205205
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
206206
if (duration > 1) {
207-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
207+
Counters::increment(UNWINDING_TIME, duration);
208208
}
209209
return true;
210210
}
211211

212212
const u64 endTime = TSC::ticks();
213213
const u64 duration = TSC::ticks_to_millis(endTime - startTime);
214214
if (duration > 1) {
215-
Counters::increment(UNWINDING_COMPILED_TIME, duration);
215+
Counters::increment(UNWINDING_TIME, duration);
216216
}
217217
return false;
218218
}

0 commit comments

Comments
 (0)