hudson.model
Class LoadStatistics

java.lang.Object
  extended by hudson.model.LoadStatistics
Direct Known Subclasses:
OverallLoadStatistics, UnlabeledLoadStatistics

@ExportedBean
public abstract class LoadStatistics
extends Object

Utilization statistics for a node or a set of nodes.

Implementation Note

Instances of this class is not capable of updating the statistics itself — instead, it's done by the LoadStatistics.LoadStatisticsUpdater timer. This is more efficient (as it allows us a single pass to update all stats), but it's not clear to me if the loss of autonomy is worth it.

Author:
Kohsuke Kawaguchi
See Also:
Label.loadStatistics, Jenkins.overallLoad, Jenkins.unlabeledLoad

Nested Class Summary
static class LoadStatistics.LoadStatisticsUpdater
          Periodically update the load statistics average.
 
Field Summary
 MultiStageTimeSeries busyExecutors
          Number of busy executors and how it changes over time.
static int CLOCK
          Load statistics clock cycle in milliseconds.
static float DECAY
          With 0.90 decay ratio for every 10sec, half reduction is about 1 min.
 MultiStageTimeSeries queueLength
          Number of Queue.BuildableItems that can run on any node in this node set but blocked.
 MultiStageTimeSeries totalExecutors
          Number of total executors and how it changes over time.
 
Constructor Summary
protected LoadStatistics(int initialTotalExecutors, int initialBusyExecutors)
           
 
Method Summary
abstract  int computeIdleExecutors()
          Computes the # of idle executors right now and obtains the snapshot value.
abstract  int computeQueueLength()
          Computes the # of queue length right now and obtains the snapshot value.
abstract  int computeTotalExecutors()
          Computes the # of total executors right now and obtains the snapshot value.
protected  void configureRenderer(org.jfree.chart.renderer.category.LineAndShapeRenderer renderer)
           
 org.jfree.chart.JFreeChart createChart(org.jfree.data.category.CategoryDataset ds)
          Creates a trend chart.
 MultiStageTimeSeries.TrendChart createTrendChart(MultiStageTimeSeries.TimeScale timeScale)
          Creates CategoryDataset which then becomes the basis of the load statistics graph.
 MultiStageTimeSeries.TrendChart doGraph(String type)
          Generates the load statistics graph.
 Api getApi()
           
 float getLatestIdleExecutors(MultiStageTimeSeries.TimeScale timeScale)
           
protected  void updateExecutorCounts()
          Updates totalExecutors and busyExecutors by using the current snapshot value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

busyExecutors

@Exported
public final MultiStageTimeSeries busyExecutors
Number of busy executors and how it changes over time.


totalExecutors

@Exported
public final MultiStageTimeSeries totalExecutors
Number of total executors and how it changes over time.


queueLength

@Exported
public final MultiStageTimeSeries queueLength
Number of Queue.BuildableItems that can run on any node in this node set but blocked.


DECAY

public static final float DECAY
With 0.90 decay ratio for every 10sec, half reduction is about 1 min.


CLOCK

public static int CLOCK
Load statistics clock cycle in milliseconds. Specify a small value for quickly debugging this feature and node provisioning through cloud.

Constructor Detail

LoadStatistics

protected LoadStatistics(int initialTotalExecutors,
                         int initialBusyExecutors)
Method Detail

getLatestIdleExecutors

public float getLatestIdleExecutors(MultiStageTimeSeries.TimeScale timeScale)

computeIdleExecutors

public abstract int computeIdleExecutors()
Computes the # of idle executors right now and obtains the snapshot value.


computeTotalExecutors

public abstract int computeTotalExecutors()
Computes the # of total executors right now and obtains the snapshot value.


computeQueueLength

public abstract int computeQueueLength()
Computes the # of queue length right now and obtains the snapshot value.


createChart

public org.jfree.chart.JFreeChart createChart(org.jfree.data.category.CategoryDataset ds)
Creates a trend chart.


configureRenderer

protected void configureRenderer(org.jfree.chart.renderer.category.LineAndShapeRenderer renderer)

createTrendChart

public MultiStageTimeSeries.TrendChart createTrendChart(MultiStageTimeSeries.TimeScale timeScale)
Creates CategoryDataset which then becomes the basis of the load statistics graph.


doGraph

public MultiStageTimeSeries.TrendChart doGraph(@QueryParameter
                                               String type)
                                        throws IOException
Generates the load statistics graph.

Throws:
IOException

getApi

public Api getApi()

updateExecutorCounts

protected void updateExecutorCounts()
Updates totalExecutors and busyExecutors by using the current snapshot value. queueLength is updated separately via LoadStatistics.LoadStatisticsUpdater to improve the efficiency because we are counting this for all LoadStatistics at once.



Copyright © 2004-2013. All Rights Reserved.