Package com.sun.cldchi.tools.memoryprofiler.jdwp

Examples of com.sun.cldchi.tools.memoryprofiler.jdwp.VMReply


  private void update() throws SocketException {
    getClassList();
    getAllData();
    getRoots();
    try {
      VMReply r = _connector.sendReplyCommand(MPGetGlobalData);
      _heap_start =     r.getInt();
      _heap_top =       r.getInt();
      _old_gen_end =    r.getInt();
      _allocation_top = r.getInt();
    }catch(DebugeeException e) {
      reset();
      throw new SocketException(e.getMessage());
    }catch(BoundException e) {
      reset();
View Full Code Here


  public JavaClass[] getClassList() throws SocketException {
    _allClasses.clear();
    JavaClass[] result = null;
    try {
      VMReply r = _connector.sendReplyCommand(MPGetClasses);
      int classesCount = r.getInt();
      result = new JavaClass[classesCount];
      for(int i=0 ; i<classesCount ; i++){
        int class_id = (int)r.getInt();
        String class_name = objectTypeNameFromJNI(r.getString());
        JavaClass new_item = new JavaClass(class_id, class_name);
        _allClasses.put(new Integer(class_id), new_item);
        result[i] = new_item;
      }
    } catch (Exception e) {
View Full Code Here

    int read = 1;
    int oread = 1;
    _allJavaObjects.clear();
    try {
      while (true) {
        VMReply r = _connector.sendReplyCommand(MPGetHeapData);
        int object_address = r.getInt();
        while (object_address != -1 && object_address != -2) {
          int size = r.getInt();
          int mp_class_id = r.getInt();
          int object_type = mp_class_id >> OBJ_TYPE_OFFSET;
          int stack_number = -1;
          if (object_type == STACK_OBJECT) {
            stack_number = r.getInt();
            read++;
          }
          int links = r.getInt();
          int[] refs = new int[links];
          HashMap offsets = new HashMap(links);
          if (object_type == STACK_OBJECT) {
            for (int i = 0; i < links; i++) {
              refs[i] = r.getInt();
              int offset = r.getInt();
              Integer cur_offset = (Integer)offsets.get(new Integer(refs[i]));
              if (cur_offset == null || cur_offset.intValue() < offset) {
                offsets.put(new Integer(refs[i]), new Integer(offset));
              }
            }
            read += links;
          } else {
            for (int i = 0; i < links; i++) {
              refs[i] = r.getInt();
            }
          }
          mp_class_id = mp_class_id & 0x7FFFFF;
          JavaClass class_item = (JavaClass)_allClasses.get(new Integer(mp_class_id));
          int class_id = mp_class_id;
          if (class_item != null) {
            class_id = class_item.id;
          }
          if (object_type == JAVA_OBJECT) {
            _allJavaObjects.put(new Integer(object_address),
               new JavaObject(object_address, class_id, size, refs, JAVA_OBJECT));
          } else if (object_type == STATICS_OBJECT) {
            _allJavaObjects.put(new Integer(object_address),
               new JavaObject(object_address, class_id, size, refs, STATICS_OBJECT));
          } else if (object_type == STACK_OBJECT) {
            _allJavaObjects.put(new Integer(object_address),
               new JavaObject(object_address, -1, size, refs, STACK_OBJECT, offsets, stack_number));
          } else if (object_type == VM_OBJECT) {
            _allJavaObjects.put(new Integer(object_address),
               new JavaObject(object_address, -1, size, refs, VM_OBJECT));
          } else {
            System.out.println("Wrong response from VM! Unknown object type. Skipped!");
          }
          object_address = r.getInt();
          read += 4;
          read += links;
          oread++;
        }        
        if (object_address == -1) break;
View Full Code Here

    }
  }

  private void getRoots() throws SocketException {
    try {
      VMReply r = _connector.sendReplyCommand(MPGetRoots);
      int root = r.getInt();
      while (root != -1) {
        Integer key = new Integer(root);
        JavaObject obj = (JavaObject)_allJavaObjects.get(key);
        if (obj != null) {
          obj.setRootDistance(0);
        }
        root = r.getInt();
      }
    } catch (Exception e) {
      reset();
      throw new SocketException(e.getMessage());
    }
View Full Code Here

    params[0] = stack_object._stack_id;
    Integer offset = (Integer)stack_object._stack_offsets.get(new Integer(ptr));
    params[1] = offset.intValue();
    String result = null;
    try {
      VMReply reply = _connector.sendReplyCommand(MPVMStackTrace, params);
      result = reply.getString();
    } catch (Exception e) {
      result = "VM connection is broken!";
      reset();
      throw new SocketException(e.getMessage());
    }
View Full Code Here

TOP

Related Classes of com.sun.cldchi.tools.memoryprofiler.jdwp.VMReply

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.