All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jppf.execute.ExecutionInfo Maven / Gradle / Ivy

There is a newer version: 6.3-alpha
Show newest version
/*
 * JPPF.
 * Copyright (C) 2005-2015 JPPF Team.
 * http://www.jppf.org
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.jppf.execute;

import java.io.Serializable;

/**
 * Instances of this class hold statistics about the execution of a tasks bundle.
 * @author Laurent Cohen
 * @exclude
 */
public class ExecutionInfo implements Serializable
{
  /**
   * Explicit serialVersionUID.
   */
  private static final long serialVersionUID = 1L;
  /**
   * Total cpu time used by the tasks.
   */
  public long cpuTime;
  /**
   * Total user time used by the tasks.
   */
  public long userTime;

  /**
   * Default no-arg constructor.
   */
  public ExecutionInfo()
  {
    this(0L, 0L);
  }

  /**
   * Default no-args constructor.
   * @param cpuTime total cpu time used by the tasks.
   * @param userTime total user time used by the tasks.
   */
  public ExecutionInfo(final long cpuTime, final long userTime)
  {
    this.cpuTime = cpuTime;
    this.userTime = userTime;
  }

  /**
   * Add the times of another instance to this one.
   * @param other the other execution info object from which to add the values.
   * @return this execution info.
   */
  public ExecutionInfo add(final ExecutionInfo other)
  {
    cpuTime += other.cpuTime;
    userTime += other.userTime;
    return this;
  }

  /**
   * Subtract the times of another instance from this one.
   * @param other the other execution info object from which to subtract the values.
   * @return this execution info.
   */
  public ExecutionInfo subtract(final ExecutionInfo other)
  {
    cpuTime -= other.cpuTime;
    userTime -= other.userTime;
    return this;
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy