Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specialized instrumentation for different cases #109

Open
wants to merge 78 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
46c438d
WIP
0xaa4eb Jan 2, 2024
074f67e
WIP
0xaa4eb Jan 3, 2024
c2ca43b
WIP
0xaa4eb Jan 3, 2024
074df92
WIP
0xaa4eb Jan 3, 2024
94af98b
Merge branch 'master' into async-recording
0xaa4eb Jan 3, 2024
aa7c9b6
WIP
0xaa4eb Jan 5, 2024
7eab345
Merge branch 'master' into async-recording
0xaa4eb Jan 5, 2024
2b437f0
WIP
0xaa4eb Jan 5, 2024
1071079
WIP
0xaa4eb Jan 5, 2024
a33a74a
WIP
0xaa4eb Jan 6, 2024
d81bb8f
Fix tests
0xaa4eb Jan 6, 2024
11feba2
Fix tests
0xaa4eb Jan 6, 2024
e3f17e8
WIP
0xaa4eb Jan 7, 2024
4e4d7fa
Merge branch 'master' into async-recording
0xaa4eb Jan 11, 2024
c244526
support recording collections
0xaa4eb Jan 11, 2024
5d801f9
simple object pool
0xaa4eb Jan 11, 2024
dcc1dbc
cache line padded array
0xaa4eb Jan 11, 2024
947e1f5
Fix tests
0xaa4eb Jan 12, 2024
7a3d56f
Fix tests
0xaa4eb Jan 12, 2024
baf1f24
Fix tests
0xaa4eb Jan 13, 2024
fc85e47
Merge branch 'master' into async-recording
0xaa4eb Jan 19, 2024
b44ed15
Merge master
0xaa4eb Jan 19, 2024
24875c2
Fixes
0xaa4eb Jan 19, 2024
3e9eff3
Fix test
0xaa4eb Jan 19, 2024
111ac95
Commit WIP
0xaa4eb Jan 23, 2024
28d02c3
Commit WIP
0xaa4eb Jan 27, 2024
9192adf
Merge branch 'managed-mem-pool' into async-recording
0xaa4eb Jan 27, 2024
a772e0f
Commit WIP
0xaa4eb Jan 27, 2024
230b7dc
updates
0xaa4eb Jan 31, 2024
8ea5fab
Merge branch 'managed-mem-pool' into async-recording
0xaa4eb Jan 31, 2024
bfde879
commit WIP
0xaa4eb Feb 1, 2024
b18d78a
commit WIP
0xaa4eb Feb 2, 2024
291d80c
commit WIP
0xaa4eb Feb 2, 2024
2cf789f
commit WIP
0xaa4eb Feb 3, 2024
93e002f
commit WIP
0xaa4eb Feb 5, 2024
d148acb
WIP compression
0xaa4eb Feb 5, 2024
63cd7b0
commit WIP
0xaa4eb Feb 5, 2024
74c1922
commit WIP
0xaa4eb Feb 6, 2024
fafd077
Fix tests
0xaa4eb Feb 6, 2024
97058db
Merge branch 'master' into async-recording
0xaa4eb Feb 7, 2024
653d6c7
Merge branch 'master' into async-recording
0xaa4eb Feb 8, 2024
06f15f4
Merge branch 'master' into async-recording
0xaa4eb Feb 8, 2024
d1afacd
Merge metrics
0xaa4eb Feb 8, 2024
4153c08
Report recording queue stalls in metrics
0xaa4eb Feb 9, 2024
3b63ca1
Merge branch 'master' into async-recording
0xaa4eb Feb 10, 2024
5d49c41
Fix identity object record
0xaa4eb Feb 10, 2024
ac7c246
Merge branch 'master' into async-recording
0xaa4eb Feb 11, 2024
8812631
Merge master
0xaa4eb Feb 11, 2024
a4fd70e
Less forks for benchmarks
0xaa4eb Feb 12, 2024
abe343b
Merge remote-tracking branch 'origin/master'
0xaa4eb Feb 13, 2024
272fa43
Merge branch 'master' into async-recording
0xaa4eb Feb 13, 2024
386fe1f
Fix merge
0xaa4eb Feb 13, 2024
619eab9
Support ordinary objects as callee
0xaa4eb Feb 13, 2024
ff5d00d
Fix test
0xaa4eb Feb 13, 2024
ccb0509
Fix test
0xaa4eb Feb 13, 2024
5459ef9
Allocate less
0xaa4eb Feb 13, 2024
5d28667
Allocate less objects
0xaa4eb Feb 14, 2024
9251204
Nullify reference after event is used
0xaa4eb Feb 14, 2024
61a63ff
Split advice for start and continue only recordings
0xaa4eb Feb 15, 2024
c8981c2
Split advice fixes
0xaa4eb Feb 15, 2024
dd28738
Fix bug
0xaa4eb Feb 16, 2024
1441f2f
Do not specify benchmark to run
0xaa4eb Feb 12, 2024
ee00509
Fix pooling
0xaa4eb Feb 20, 2024
6a8fa25
Fix unneeded lookups
0xaa4eb Feb 20, 2024
e696afb
Sleep millisecond on background thread
0xaa4eb Feb 20, 2024
e87681b
Close recording queue
0xaa4eb Feb 21, 2024
c0e4c7c
Some fixes
0xaa4eb Feb 21, 2024
932c8c6
Fix test
0xaa4eb Feb 21, 2024
c047654
Some fixes
0xaa4eb Feb 23, 2024
22742e7
Minor fixes
0xaa4eb Feb 23, 2024
ef08e9b
Merge branch 'master' into async-recording
0xaa4eb Feb 23, 2024
179375c
Bigger recording queue for massive benchmarks
0xaa4eb Feb 23, 2024
6d61dd8
Comments
0xaa4eb Feb 23, 2024
0a90812
Merge branch 'async-recording' into async-recording-advice-split
0xaa4eb Feb 24, 2024
ed3612b
0 args advice WIP
0xaa4eb Feb 24, 2024
0c900da
Merge branch 'master' into async-recording-advice-split
0xaa4eb Feb 24, 2024
75750e1
Merge branch 'master' into async-recording-advice-split
0xaa4eb Mar 2, 2024
0834192
Merge branch 'refs/heads/master' into async-recording-advice-split
0xaa4eb Apr 8, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 0 additions & 26 deletions ulyp-agent-core/src/main/java/com/ulyp/agent/AgentDataWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ public class AgentDataWriter {
@Getter
private final MethodRepository methodRepository;
private final AtomicInteger lastIndexOfMethodWritten = new AtomicInteger(-1);
private final AtomicInteger lastIndexOfMethodToRecordWritten = new AtomicInteger(-1);
private final AtomicInteger lastIndexOfTypeWritten = new AtomicInteger(-1);

public AgentDataWriter(RecordingDataWriter recordingDataWriter, MethodRepository methodRepository) {
Expand Down Expand Up @@ -59,31 +58,6 @@ public void write(TypeResolver typeResolver, RecordingMetadata recordingMetadata
}
}

methodsList = new SerializedMethodList();
methods = methodRepository.getRecordingStartMethods();
upToExcluding = methods.size() - 1;
startFrom = lastIndexOfMethodToRecordWritten.get() + 1;

for (int i = startFrom; i <= upToExcluding; i++) {
Method method = methods.get(i);
log.debug("Will write {} to storage", method);
methodsList.add(method);
}
if (methodsList.size() > 0) {
recordingDataWriter.write(methodsList);
for (;;) {
int currentIndex = lastIndexOfMethodToRecordWritten.get();
if (currentIndex < upToExcluding) {
if (lastIndexOfMethodToRecordWritten.compareAndSet(currentIndex, upToExcluding)) {
break;
}
} else {
// Someone else must have written methods already
break;
}
}
}

SerializedTypeList typesList = new SerializedTypeList();
ConcurrentArrayList<Type> types = typeResolver.values();
upToExcluding = types.size() - 1;
Expand Down
4 changes: 4 additions & 0 deletions ulyp-agent-core/src/main/java/com/ulyp/agent/Recorder.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,10 @@ public int onConstructorEnter(RecordingState recordingState, int methodId, Objec
return onMethodEnter(recordingState, methodId, null, args);
}

public int onMethodEnter(int methodId, @Nullable Object callee) {
return onMethodEnter(threadLocalRecordingState.get(), methodId, callee, null);
}

public int onMethodEnter(int methodId, @Nullable Object callee, Object[] args) {
return onMethodEnter(threadLocalRecordingState.get(), methodId, callee, args);
}
Expand Down
10 changes: 7 additions & 3 deletions ulyp-agent-core/src/main/java/com/ulyp/agent/Settings.java
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
package com.ulyp.agent;

import com.ulyp.core.ProcessMetadata;
import com.ulyp.core.recorders.collections.CollectionsRecordingMode;
import com.ulyp.core.util.MethodMatcher;
import com.ulyp.core.util.TypeMatcher;
import com.ulyp.core.util.CommaSeparatedList;
import com.ulyp.core.util.PackageList;
import com.ulyp.storage.writer.RecordingDataWriter;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.nio.file.Paths;
import java.util.List;
import java.util.Optional;
import java.util.Set;
import java.util.function.Supplier;
import java.util.regex.Pattern;
import java.util.stream.Collectors;

Expand Down Expand Up @@ -121,6 +120,11 @@ public static Settings fromSystemProperties() {
String methodsToRecordRaw = System.getProperty(START_RECORDING_METHODS_PROPERTY, "");
String excludeMethodsToRecordRaw = System.getProperty(EXCLUDE_RECORDING_METHODS_PROPERTY, "");
StartRecordingMethods recordingStartMethods = StartRecordingMethods.parse(methodsToRecordRaw, excludeMethodsToRecordRaw);
if (recordingStartMethods.isEmpty()) {
recordingStartMethods = StartRecordingMethods.of(
new MethodMatcher(TypeMatcher.parse(ProcessMetadata.getMainClassNameFromProp()), "main")
);
}

String recordingDataFilePath = System.getProperty(FILE_PATH_PROPERTY);
if (recordingDataFilePath == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ void onEnterCallRecord(EnterRecordQueueEvent enterRecord) {
buffer.recordMethodEnter(
enterRecord.getCallId(),
typeResolver,
/* TODO remove after advice split */methodRepository.get(enterRecord.getMethodId()).getId(),
enterRecord.getMethodId(),
cachedQueuedIdentityCallee,
enterRecord.getArgs(),
nanoTime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ public void enqueueMethodExit(int recordingId, int callId, Object returnValue, b
}

private Object[] convert(Object[] args) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Optional?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, we can not. Unlike Rust/C++, Java Optional is not zero-cost. In Ulyp we strive for maximum performance for our clients' recorded applications even at the cost of readability.

if (args == null) {
return null;
}
for (int i = 0; i < args.length; i++) {
args[i] = convert(args[i]);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ulyp.agent.queue.disruptor;

import com.lmax.disruptor.EventHandler;
import com.lmax.disruptor.EventProcessor;
import com.lmax.disruptor.Sequence;
import com.lmax.disruptor.WorkHandler;
Expand Down
Loading
Loading