public OpUnitMask getUnitMask() {
    OpEvent event = _daemonEvent.getEvent();

    if (event != null) {
      return event.getUnitMask();
    } else {
      return null;
    }
  }
  /**
   * 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) {

    }
  }
 /**
  * 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());
 }
 /**
  * Method setProfileKernel.
  *
  * @param profileKernel whether this counter should count kernel events
  */
 public void setProfileKernel(boolean profileKernel) {
   _daemonEvent.setProfileKernel(profileKernel);
 }
 /**
  * Method setEvent.
  *
  * @param event the event for this counter
  */
 public void setEvent(OpEvent event) {
   _daemonEvent.setEvent(event);
 }
 /**
  * Method getCount.
  *
  * @return the number of events between samples for this counter
  */
 public int getCount() {
   return _daemonEvent.getResetCount();
 }
 /**
  * Method getProfileUser.
  *
  * @return whether this counter is counting user events
  */
 public boolean getProfileUser() {
   return _daemonEvent.getProfileUser();
 }
 /**
  * Method getProfileKernel.
  *
  * @return whether this counter is counting kernel events
  */
 public boolean getProfileKernel() {
   return _daemonEvent.getProfileKernel();
 }
 /**
  * Method getEvent.
  *
  * @return the event for this counter
  */
 public OpEvent getEvent() {
   return _daemonEvent.getEvent();
 }
 /**
  * Method setCount.
  *
  * @param count the number of events between samples for this counter
  */
 public void setCount(int count) {
   _daemonEvent.setResetCount(count);
 }
 /**
  * Method setProfileUser.
  *
  * @param profileUser whether this counter should count user events
  */
 public void setProfileUser(boolean profileUser) {
   _daemonEvent.setProfileUser(profileUser);
 }