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

Function Java_one_profiler_AsyncProfiler_execute0

src/javaApi.cpp:57–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57extern "C" DLLEXPORT jstring JNICALL
58Java_one_profiler_AsyncProfiler_execute0(JNIEnv* env, jobject unused, jstring command) {
59 Arguments args;
60 const char* command_str = env->GetStringUTFChars(command, NULL);
61 Error error = args.parse(command_str);
62 env->ReleaseStringUTFChars(command, command_str);
63
64 if (error) {
65 throwNew(env, "java/lang/IllegalArgumentException", error.message());
66 return NULL;
67 }
68
69 Log::open(args);
70
71 if (!args.hasOutputFile()) {
72 BufferWriter out;
73 error = Profiler::instance()->runInternal(args, out);
74 if (!error) {
75 out << '\0';
76 if (out.size() >= 0x3fffffff) {
77 throwNew(env, "java/lang/IllegalStateException", "Output exceeds string size limit");
78 return NULL;
79 }
80 return env->NewStringUTF(out.buf());
81 }
82 } else {
83 FileWriter out(args.file());
84 if (!out.is_open()) {
85 throwNew(env, "java/io/IOException", strerror(errno));
86 return NULL;
87 }
88 error = Profiler::instance()->runInternal(args, out);
89 if (!error) {
90 return env->NewStringUTF("OK");
91 }
92 }
93
94 throwNew(env, "java/lang/IllegalStateException", error.message());
95 return NULL;
96}
97
98extern "C" DLLEXPORT jbyteArray JNICALL
99Java_one_profiler_AsyncProfiler_execute1(JNIEnv* env, jobject unused, jstring command) {

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected