Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.measurement
Class TimingVoodoo

java.lang.Object
  extended by org.hyperic.hq.measurement.TimingVoodoo

public final class TimingVoodoo
extends java.lang.Object

This helper class is full of "voodoo" functions related to synchronizing timed data between the agent and the server. We call them "voodoo" because they deal mostly with rounding down and guestimating percentages.


Method Summary
static long[] aggregate(long approxTime, long interval, int backTicks)
          Compute the upper and lower bound that should be used in the SQL query for finding the collected data points based on the approximate time they were taken, the interval and how many intervals of data are being considered in the aggregate function.
static long closestTime(long approxTime, long interval)
          Given the approximate time associated with a data point and the interval at which that adta point is being collected, compute the exact data point to which the data point corresponds.
static long[] current(long approxTime, long interval)
          Compute the upper and lower bound that should be used in the SQL query for finding the collected data points based on the approximate time they were taken and the interval.
static long percOfInterval(long interval)
          Compute (in milliseconds) what is considered the latency percentage based on the interval.
static long[] previous(long approxTime, long interval, int backTicks)
          Compute the upper and lower bound that should be used in the SQL query for finding the collected data points based on the approximate time they were taken, the interval and how many intervals ago the data was collected.
static long roundDownTime(long approxTime, long interval)
          Given the approximate time associated with a data point and the interval at which that adta point is being collected, compute the exact data point to which the data point corresponds.
static long roundUpTime(long approxTime, long interval)
          Given the approximate time and interval, round the time up to the nearest timestamp that coincides with the interval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

roundDownTime

public static long roundDownTime(long approxTime,
                                 long interval)
Given the approximate time associated with a data point and the interval at which that adta point is being collected, compute the exact data point to which the data point corresponds.

Parameters:
approxTime - the approximate time to which the data point corresponds
interval - the collection interval
Returns:
the time, rounded down to the previous collection interval

roundUpTime

public static long roundUpTime(long approxTime,
                               long interval)
Given the approximate time and interval, round the time up to the nearest timestamp that coincides with the interval.

Parameters:
approxTime - the approximate time
interval - the collection interval
Returns:
the time, rounded up to the next interval

closestTime

public static long closestTime(long approxTime,
                               long interval)
Given the approximate time associated with a data point and the interval at which that adta point is being collected, compute the exact data point to which the data point corresponds.

Parameters:
approxTime - the approximate time to which the data point corresponds
interval - the collection interval
Returns:
the time, rounded up or down to the closest collection interval

current

public static long[] current(long approxTime,
                             long interval)
Compute the upper and lower bound that should be used in the SQL query for finding the collected data points based on the approximate time they were taken and the interval.

Parameters:
approxTime - the approximate time the data points were collected
interval - the collection interval
Returns:
an array of size 2: the upper and lower bound

previous

public static long[] previous(long approxTime,
                              long interval,
                              int backTicks)
Compute the upper and lower bound that should be used in the SQL query for finding the collected data points based on the approximate time they were taken, the interval and how many intervals ago the data was collected.

Parameters:
approxTime - the approximate time the data points were collected
interval - the collection interval
Returns:
an array of size 3: the upper and lower bound, and the exact interval time considering backTicks

aggregate

public static long[] aggregate(long approxTime,
                               long interval,
                               int backTicks)
Compute the upper and lower bound that should be used in the SQL query for finding the collected data points based on the approximate time they were taken, the interval and how many intervals of data are being considered in the aggregate function.

Parameters:
approxTime - the approximate time the data points were collected
interval - the collection interval
Returns:
an array of size 2: the upper and lower bound

percOfInterval

public static long percOfInterval(long interval)
Compute (in milliseconds) what is considered the latency percentage based on the interval.

Parameters:
interval - the collection interval
Returns:
latency percentage cushion

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.