Ejemplo n.º 1
0
  /**
   * Loads a counter configuration from the specified launch configuration.
   *
   * @param config the launch configuration
   */
  public void loadConfiguration(ILaunchConfiguration config) {
    try {
      _enabled = config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_ENABLED(_number), false);

      String str =
          config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_EVENT(_number), ""); // $NON-NLS-1$
      _daemonEvent.setEvent(_eventFromString(str));

      if (_daemonEvent.getEvent() == null) {
        return;
      }

      int maskValue =
          config.getAttribute(
              OprofileLaunchPlugin.ATTR_COUNTER_UNIT_MASK(_number), OpUnitMask.SET_DEFAULT_MASK);
      _daemonEvent.getEvent().getUnitMask().setMaskValue(maskValue);

      _daemonEvent.setProfileKernel(
          config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_KERNEL(_number), false));
      _daemonEvent.setProfileUser(
          config.getAttribute(OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_USER(_number), false));

      _daemonEvent.setResetCount(
          config.getAttribute(
              OprofileLaunchPlugin.ATTR_COUNTER_COUNT(_number),
              OprofileDaemonEvent.COUNT_UNINITIALIZED));
    } catch (CoreException ce) {

    }
  }
Ejemplo n.º 2
0
 /**
  * Saves this counter's configuration into the specified launch configuration.
  *
  * @param config the launch configuration
  */
 public void saveConfiguration(ILaunchConfigurationWorkingCopy config) {
   config.setAttribute(OprofileLaunchPlugin.ATTR_COUNTER_ENABLED(_number), _enabled);
   if (_daemonEvent.getEvent() != null) {
     config.setAttribute(
         OprofileLaunchPlugin.ATTR_COUNTER_EVENT(_number), _daemonEvent.getEvent().getText());
     config.setAttribute(
         OprofileLaunchPlugin.ATTR_COUNTER_UNIT_MASK(_number),
         _daemonEvent.getEvent().getUnitMask().getMaskValue());
   }
   config.setAttribute(
       OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_KERNEL(_number), _daemonEvent.getProfileKernel());
   config.setAttribute(
       OprofileLaunchPlugin.ATTR_COUNTER_PROFILE_USER(_number), _daemonEvent.getProfileUser());
   config.setAttribute(
       OprofileLaunchPlugin.ATTR_COUNTER_COUNT(_number), _daemonEvent.getResetCount());
 }