/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.
*/ /* * author Ian Formanek * Misha Dmitriev
*/
for (i = 0; i < 2; i++) {
jfluid_added_boot_path = (char*) malloc(path_len + strlen(jfluid_boot_class_subpaths[i]) + 1);
strcpy(jfluid_added_boot_path, _jfluid_dir);
strcpy(jfluid_added_boot_path + path_len, jfluid_boot_class_subpaths[i]);
res = (*_jvmti)->AddToBootstrapClassLoaderSearch(_jvmti, jfluid_added_boot_path);
assert(res == JVMTI_ERROR_NONE);
free(jfluid_added_boot_path);
}
}
/* * This routine updates the bootstrap class path (if necessary) and then calls * ProfilerServer.activate() method. * The activateCode parameter signals the type of attachment to the ProfilerServer: * 0 - dynamic attachment (not used so far), 1 - attach on startup
*/ static jint setupAndCallProfilerRuntimeActivate(JNIEnv *env, jint activateCode) {
jmethodID activateMethodID;
jclass profilerServerClass;
jstring jfluidDir;
/* For some reason (null classloader?) have to use slashed name - it barks if it is dotted */
profilerServerClass = (*env)->FindClass(env, "org/netbeans/lib/profiler/server/ProfilerServer"); if (profilerServerClass == NULL) { char *new_sun_boot_class_path;
(*_jvmti)->GetSystemProperty(_jvmti, "sun.boot.class.path", &new_sun_boot_class_path);
fprintf(stderr, "Profiler Agent Error: Can't start the profiler back end: main class not found\n");
fprintf(stderr, "Profiler Agent Error: Boot class path was set to: %s\n", new_sun_boot_class_path);
(*_jvmti)->Deallocate(_jvmti, (void*)new_sun_boot_class_path);
fprintf(stderr, "Profiler Agent Error: Please check if you have jfluid-server.jar on this path\n"); return -1;
}
activateMethodID = (*env)->GetStaticMethodID(env, profilerServerClass, "activate", "(Ljava/lang/String;III)V"); if (activateMethodID == NULL) {
fprintf(stderr, "Profiler Agent Error: Can't start the profiler back end: activate(String, int) method not found in main class\n"); return -1;
}
/** If the VM was launched on its own, we arrange that this is called right after the VM is initialized */ void JNICALL vm_init_hook(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread) {
setupAndCallProfilerRuntimeActivate(jni_env, ATTACH_DIRECT);
}
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.13Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.