Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moobench
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SustainKieker
moobench
Commits
0d747b07
Commit
0d747b07
authored
10 years ago
by
Jan Waller
Browse files
Options
Downloads
Patches
Plain Diff
tuning the Kicker instrumentation
parent
9156b9ed
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
frameworks/Kieker/src/mooBench/monitoredApplication/MonitoredClassManualInstrumentation.java
+29
-36
29 additions, 36 deletions
...toredApplication/MonitoredClassManualInstrumentation.java
with
29 additions
and
36 deletions
frameworks/Kieker/src/mooBench/monitoredApplication/MonitoredClassManualInstrumentation.java
+
29
−
36
View file @
0d747b07
...
...
@@ -21,7 +21,6 @@ import java.lang.management.ThreadMXBean;
import
kieker.common.record.flow.trace.TraceMetadata
;
import
kieker.common.record.flow.trace.operation.AfterOperationEvent
;
import
kieker.common.record.flow.trace.operation.AfterOperationFailedEvent
;
import
kieker.common.record.flow.trace.operation.BeforeOperationEvent
;
import
kieker.monitoring.core.controller.IMonitoringController
;
import
kieker.monitoring.core.controller.MonitoringController
;
...
...
@@ -33,6 +32,9 @@ import kieker.monitoring.timer.ITimeSource;
*/
public
final
class
MonitoredClassManualInstrumentation
implements
MonitoredClass
{
private
static
final
String
SIGNATURE
=
"public final long mooBench.monitoredApplication.MonitoredClass.monitoredMethod(long, int)"
;
private
static
final
String
CLAZZ
=
"mooBench.monitoredApplication.MonitoredClass"
;
private
static
final
IMonitoringController
CTRLINST
=
MonitoringController
.
getInstance
();
private
static
final
ITimeSource
TIME
=
CTRLINST
.
getTimeSource
();
private
static
final
TraceRegistry
TRACEREGISTRY
=
TraceRegistry
.
INSTANCE
;
...
...
@@ -47,14 +49,30 @@ public final class MonitoredClassManualInstrumentation implements MonitoredClass
}
public
final
long
monitoredMethod
(
final
long
methodTime
,
final
int
recDepth
)
{
final
TraceMetadata
trace
=
MonitoredClassManualInstrumentation
.
triggerBefore
();
long
retval
;
if
(
recDepth
>
1
)
{
retval
=
this
.
monitoredMethod
(
methodTime
,
recDepth
-
1
);
}
else
{
final
long
exitTime
=
this
.
threadMXBean
.
getCurrentThreadUserTime
()
+
methodTime
;
long
currentTime
;
do
{
currentTime
=
this
.
threadMXBean
.
getCurrentThreadUserTime
();
}
while
(
currentTime
<
exitTime
);
retval
=
currentTime
;
}
MonitoredClassManualInstrumentation
.
triggerAfter
(
trace
);
return
retval
;
}
private
final
static
TraceMetadata
triggerBefore
()
{
if
(!
CTRLINST
.
isMonitoringEnabled
())
{
return
this
.
monitoredMethod_actual
(
methodTime
,
recDepth
)
;
return
null
;
}
final
String
signature
=
"public final long mooBench.monitoredApplication.MonitoredClassThreaded.monitoredMethod(long, int)"
;
final
String
signature
=
SIGNATURE
;
if
(!
CTRLINST
.
isProbeActivated
(
signature
))
{
return
this
.
monitoredMethod_actual
(
methodTime
,
recDepth
)
;
return
null
;
}
// common fields
TraceMetadata
trace
=
TRACEREGISTRY
.
getTrace
();
final
boolean
newTrace
=
trace
==
null
;
if
(
newTrace
)
{
...
...
@@ -62,39 +80,14 @@ public final class MonitoredClassManualInstrumentation implements MonitoredClass
CTRLINST
.
newMonitoringRecord
(
trace
);
}
final
long
traceId
=
trace
.
getTraceId
();
final
String
clazz
=
this
.
getClass
().
getName
();
// measure before execution
final
String
clazz
=
CLAZZ
;
CTRLINST
.
newMonitoringRecord
(
new
BeforeOperationEvent
(
TIME
.
getTime
(),
traceId
,
trace
.
getNextOrderId
(),
signature
,
clazz
));
// execution of the called method
final
Object
retval
;
try
{
retval
=
this
.
monitoredMethod_actual
(
methodTime
,
recDepth
);
}
catch
(
final
Throwable
th
)
{
// NOPMD NOCS (catch throw might ok here)
// measure after failed execution
CTRLINST
.
newMonitoringRecord
(
new
AfterOperationFailedEvent
(
TIME
.
getTime
(),
traceId
,
trace
.
getNextOrderId
(),
signature
,
clazz
,
th
.
toString
()));
throw
new
RuntimeException
(
th
);
}
finally
{
if
(
newTrace
)
{
// close the trace
TRACEREGISTRY
.
unregisterTrace
();
}
}
// measure after successful execution
CTRLINST
.
newMonitoringRecord
(
new
AfterOperationEvent
(
TIME
.
getTime
(),
traceId
,
trace
.
getNextOrderId
(),
signature
,
clazz
));
return
(
Long
)
retval
;
return
trace
;
}
public
final
long
monitoredMethod_actual
(
final
long
methodTime
,
final
int
recDepth
)
{
if
(
recDepth
>
1
)
{
return
this
.
monitoredMethod
(
methodTime
,
recDepth
-
1
);
}
else
{
final
long
exitTime
=
this
.
threadMXBean
.
getCurrentThreadUserTime
()
+
methodTime
;
long
currentTime
;
do
{
currentTime
=
this
.
threadMXBean
.
getCurrentThreadUserTime
();
}
while
(
currentTime
<
exitTime
);
return
currentTime
;
}
private
final
static
void
triggerAfter
(
final
TraceMetadata
trace
)
{
final
String
signature
=
SIGNATURE
;
final
String
clazz
=
CLAZZ
;
CTRLINST
.
newMonitoringRecord
(
new
AfterOperationEvent
(
TIME
.
getTime
(),
trace
.
getTraceId
(),
trace
.
getNextOrderId
(),
signature
,
clazz
));
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment