< prev index next >

src/share/vm/runtime/statSampler.cpp

Print this page




 170 
 171   sample_data(_sampled);
 172 }
 173 
 174 /*
 175  * method to upcall into Java to return the value of the specified
 176  * property as a utf8 string, or NULL if does not exist. The caller
 177  * is responsible for setting a ResourceMark for proper cleanup of
 178  * the utf8 strings.
 179  */
 180 const char* StatSampler::get_system_property(const char* name, TRAPS) {
 181 
 182   // setup the arguments to getProperty
 183   Handle key_str   = java_lang_String::create_from_str(name, CHECK_NULL);
 184 
 185   // return value
 186   JavaValue result(T_OBJECT);
 187 
 188   // public static String getProperty(String key, String def);
 189   JavaCalls::call_static(&result,
 190                          KlassHandle(THREAD, SystemDictionary::System_klass()),
 191                          vmSymbols::getProperty_name(),
 192                          vmSymbols::string_string_signature(),
 193                          key_str,
 194                          CHECK_NULL);
 195 
 196   oop value_oop = (oop)result.get_jobject();
 197   if (value_oop == NULL) {
 198     return NULL;
 199   }
 200 
 201   // convert Java String to utf8 string
 202   char* value = java_lang_String::as_utf8_string(value_oop);
 203 
 204   return value;
 205 }
 206 
 207 /*
 208  * The list of System Properties that have corresponding PerfData
 209  * string instrumentation created by retrieving the named property's
 210  * value from System.getProperty() and unconditionally creating a




 170 
 171   sample_data(_sampled);
 172 }
 173 
 174 /*
 175  * method to upcall into Java to return the value of the specified
 176  * property as a utf8 string, or NULL if does not exist. The caller
 177  * is responsible for setting a ResourceMark for proper cleanup of
 178  * the utf8 strings.
 179  */
 180 const char* StatSampler::get_system_property(const char* name, TRAPS) {
 181 
 182   // setup the arguments to getProperty
 183   Handle key_str   = java_lang_String::create_from_str(name, CHECK_NULL);
 184 
 185   // return value
 186   JavaValue result(T_OBJECT);
 187 
 188   // public static String getProperty(String key, String def);
 189   JavaCalls::call_static(&result,
 190                          SystemDictionary::System_klass(),
 191                          vmSymbols::getProperty_name(),
 192                          vmSymbols::string_string_signature(),
 193                          key_str,
 194                          CHECK_NULL);
 195 
 196   oop value_oop = (oop)result.get_jobject();
 197   if (value_oop == NULL) {
 198     return NULL;
 199   }
 200 
 201   // convert Java String to utf8 string
 202   char* value = java_lang_String::as_utf8_string(value_oop);
 203 
 204   return value;
 205 }
 206 
 207 /*
 208  * The list of System Properties that have corresponding PerfData
 209  * string instrumentation created by retrieving the named property's
 210  * value from System.getProperty() and unconditionally creating a


< prev index next >