src/hotspot/share/services/attachListener.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File webrev Sdiff src/hotspot/share/services

src/hotspot/share/services/attachListener.cpp

Print this page




 258       return JNI_ERR;
 259     }
 260     live_objects_only = strcmp(arg0, "-live") == 0;
 261   }
 262   VM_GC_HeapInspection heapop(out, live_objects_only /* request full gc */);
 263   VMThread::execute(&heapop);
 264   return JNI_OK;
 265 }
 266 
 267 // Implementation of "setflag" command
 268 static jint set_flag(AttachOperation* op, outputStream* out) {
 269 
 270   const char* name = NULL;
 271   if ((name = op->arg(0)) == NULL) {
 272     out->print_cr("flag name is missing");
 273     return JNI_ERR;
 274   }
 275 
 276   FormatBuffer<80> err_msg("%s", "");
 277 
 278   int ret = WriteableFlags::set_flag(op->arg(0), op->arg(1), Flag::ATTACH_ON_DEMAND, err_msg);
 279   if (ret != Flag::SUCCESS) {
 280     if (ret == Flag::NON_WRITABLE) {
 281       // if the flag is not manageable try to change it through
 282       // the platform dependent implementation
 283       return AttachListener::pd_set_flag(op, out);
 284     } else {
 285       out->print_cr("%s", err_msg.buffer());
 286     }
 287 
 288     return JNI_ERR;
 289   }
 290   return JNI_OK;
 291 }
 292 
 293 // Implementation of "printflag" command
 294 // See also: PrintVMFlagsDCmd class
 295 static jint print_flag(AttachOperation* op, outputStream* out) {
 296   const char* name = NULL;
 297   if ((name = op->arg(0)) == NULL) {
 298     out->print_cr("flag name is missing");
 299     return JNI_ERR;
 300   }
 301   Flag* f = Flag::find_flag((char*)name, strlen(name));
 302   if (f) {
 303     f->print_as_flag(out);
 304     out->cr();
 305   } else {
 306     out->print_cr("no such flag '%s'", name);
 307   }
 308   return JNI_OK;
 309 }
 310 
 311 // Table to map operation names to functions.
 312 
 313 // names must be of length <= AttachOperation::name_length_max
 314 static AttachOperationFunctionInfo funcs[] = {
 315   { "agentProperties",  get_agent_properties },
 316   { "datadump",         data_dump },
 317   { "dumpheap",         dump_heap },
 318   { "load",             load_agent },
 319   { "properties",       get_system_properties },
 320   { "threaddump",       thread_dump },
 321   { "inspectheap",      heap_inspection },




 258       return JNI_ERR;
 259     }
 260     live_objects_only = strcmp(arg0, "-live") == 0;
 261   }
 262   VM_GC_HeapInspection heapop(out, live_objects_only /* request full gc */);
 263   VMThread::execute(&heapop);
 264   return JNI_OK;
 265 }
 266 
 267 // Implementation of "setflag" command
 268 static jint set_flag(AttachOperation* op, outputStream* out) {
 269 
 270   const char* name = NULL;
 271   if ((name = op->arg(0)) == NULL) {
 272     out->print_cr("flag name is missing");
 273     return JNI_ERR;
 274   }
 275 
 276   FormatBuffer<80> err_msg("%s", "");
 277 
 278   int ret = WriteableFlags::set_flag(op->arg(0), op->arg(1), JVMFlag::ATTACH_ON_DEMAND, err_msg);
 279   if (ret != JVMFlag::SUCCESS) {
 280     if (ret == JVMFlag::NON_WRITABLE) {
 281       // if the flag is not manageable try to change it through
 282       // the platform dependent implementation
 283       return AttachListener::pd_set_flag(op, out);
 284     } else {
 285       out->print_cr("%s", err_msg.buffer());
 286     }
 287 
 288     return JNI_ERR;
 289   }
 290   return JNI_OK;
 291 }
 292 
 293 // Implementation of "printflag" command
 294 // See also: PrintVMFlagsDCmd class
 295 static jint print_flag(AttachOperation* op, outputStream* out) {
 296   const char* name = NULL;
 297   if ((name = op->arg(0)) == NULL) {
 298     out->print_cr("flag name is missing");
 299     return JNI_ERR;
 300   }
 301   JVMFlag* f = JVMFlag::find_flag((char*)name, strlen(name));
 302   if (f) {
 303     f->print_as_flag(out);
 304     out->cr();
 305   } else {
 306     out->print_cr("no such flag '%s'", name);
 307   }
 308   return JNI_OK;
 309 }
 310 
 311 // Table to map operation names to functions.
 312 
 313 // names must be of length <= AttachOperation::name_length_max
 314 static AttachOperationFunctionInfo funcs[] = {
 315   { "agentProperties",  get_agent_properties },
 316   { "datadump",         data_dump },
 317   { "dumpheap",         dump_heap },
 318   { "load",             load_agent },
 319   { "properties",       get_system_properties },
 320   { "threaddump",       thread_dump },
 321   { "inspectheap",      heap_inspection },


src/hotspot/share/services/attachListener.cpp
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File