MCPcopy Create free account
hub / github.com/async-profiler/async-profiler / Java_one_profiler_AsyncProfiler_execute1

Function Java_one_profiler_AsyncProfiler_execute1

src/javaApi.cpp:98–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

96}
97
98extern "C" DLLEXPORT jbyteArray JNICALL
99Java_one_profiler_AsyncProfiler_execute1(JNIEnv* env, jobject unused, jstring command) {
100 Arguments args;
101 const char* command_str = env->GetStringUTFChars(command, NULL);
102 Error error = args.parse(command_str);
103 env->ReleaseStringUTFChars(command, command_str);
104
105 if (error) {
106 throwNew(env, "java/lang/IllegalArgumentException", error.message());
107 return NULL;
108 }
109 if (args.hasOutputFile()) {
110 throwNew(env, "java/lang/IllegalArgumentException", "execute1 calls should not specify an output file argument");
111 return NULL;
112 }
113
114 Log::open(args);
115
116 BufferWriter out;
117 // TODO: This is doing one more copy than necessary, from ProtoWriter to BufferWriter
118 error = Profiler::instance()->runInternal(args, out);
119 if (error) {
120 throwNew(env, "java/lang/IllegalStateException", error.message());
121 return NULL;
122 }
123
124 jbyteArray output = env->NewByteArray(out.size());
125 env->SetByteArrayRegion(output, 0, out.size(), (const jbyte*) out.buf());
126 return output;
127}
128
129extern "C" DLLEXPORT jlong JNICALL
130Java_one_profiler_AsyncProfiler_getSamples(JNIEnv* env, jobject unused) {

Callers

nothing calls this directly

Calls 7

throwNewFunction · 0.85
messageMethod · 0.80
hasOutputFileMethod · 0.80
runInternalMethod · 0.80
bufMethod · 0.80
parseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected