public interface IHostModel
This interface represents a host system, for example a machine running Linux, and allows to access information on the state of the machine at some time[range]. Typically, there would be one model instance per host and all traces taken on the same host (machine) will share the same model. Users of the model do not need to know where the information comes from. For each method providing information, a default value will be provided in case the information is not available. See the method's javadoc for that value. How the host information is accessed is up to each implementations. It can make use of the various analyses of the traces that compose this model.
Author:
Geneviève Bastien
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
    An enumeration of the types of data one can need.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final long
    Value to use when a duration or timestamp is not known
    static final int
    Value to use for thread ID
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Dispose of the model when it is not needed anymore
    long
    getCpuTime(int tid, long start, long end)
    Get the amount of time a thread was active on the CPU (any CPU) during a period.
    @Nullable String
    getExecName(int tid, long t)
    Get the executable name of a thread
    int
    getProcessId(int tid, long t)
    Get the process ID of a thread
    Get the analyses modules required to get the data requested
    getSamplingData(int tid, long start, long end)
    Get the aggregated sample data for a thread in a time range.
    default int
    getThreadOnCpu(int cpu, long t)
    Get which thread is running on the CPU at a given time
    int
    getThreadOnCpu(int cpu, long t, boolean block)
    Get which thread is running on the CPU at a given time, but may blocks if the answer is not available yet but may come later
    getThreadStatusIntervals(int tid, long start, long end, long resolution)
    Get an iterable over the status intervals of a thread
    boolean
    Get whether sampling data is available for this host
    boolean
    Get whether thread status information is available for this host
  • Field Details

    • UNKNOWN_TID

      static final int UNKNOWN_TID
      Value to use for thread ID
      See Also:
    • TIME_UNKNOWN

      static final long TIME_UNKNOWN
      Value to use when a duration or timestamp is not known
      See Also:
  • Method Details

    • getThreadOnCpu

      default int getThreadOnCpu(int cpu, long t)
      Get which thread is running on the CPU at a given time
      Parameters:
      cpu - The CPU ID on which the thread is running
      t - The desired time
      Returns:
      The ID of the thread running on the CPU, or UNKNOWN_TID if it is not available
    • getThreadOnCpu

      int getThreadOnCpu(int cpu, long t, boolean block)
      Get which thread is running on the CPU at a given time, but may blocks if the answer is not available yet but may come later
      Parameters:
      cpu - The CPU ID on which the thread is running
      t - The desired time
      block - If true, the method will block until the providers have the data available.
      Returns:
      The ID of the thread running on the CPU, or UNKNOWN_TID if it is not available
    • getProcessId

      int getProcessId(int tid, long t)
      Get the process ID of a thread
      Parameters:
      tid - The ID of the thread for which to get the process ID
      t - The desired time. A negative value will return the first found value
      Returns:
      The ID of the process this thread is part of, or UNKNOWN_TID if it is not available
    • getExecName

      @Nullable String getExecName(int tid, long t)
      Get the executable name of a thread
      Parameters:
      tid - The ID of the thread for which to get the process ID
      t - The desired time. A negative value will return the first found value.
      Returns:
      The executable name of the thread or null if the name is not found
    • getCpuTime

      long getCpuTime(int tid, long start, long end)
      Get the amount of time a thread was active on the CPU (any CPU) during a period.
      Parameters:
      tid - The ID of the thread
      start - The start of the period for which to get the time on CPU
      end - The end of the period for which to get the time on CPU
      Returns:
      The time spent on the CPU by the thread in that duration or TIME_UNKNOWN if it is not available
    • getSamplingData

      Collection<AggregatedCallSite> getSamplingData(int tid, long start, long end)
      Get the aggregated sample data for a thread in a time range.
      Parameters:
      tid - The ID of the thread
      start - The start of the period for which to get the time on CPU
      end - The end of the period for which to get the time on CPU
      Returns:
      The collection of aggregated sampling data for the time range
    • getThreadStatusIntervals

      Iterable<ProcessStatusInterval> getThreadStatusIntervals(int tid, long start, long end, long resolution)
      Get an iterable over the status intervals of a thread
      Parameters:
      tid - The ID of the thread
      start - The start of the period for which to get the time on CPU
      end - The end of the period for which to get the time on CPU
      resolution - The resolution, ie the number of nanoseconds between kernel status queries. A value lower or equal to 1 will return all intervals.
      Returns:
      An iterator over the status intervals for the thread
    • isSamplingDataAvailable

      boolean isSamplingDataAvailable()
      Get whether sampling data is available for this host
      Returns:
      true if sampling data is available, false otherwise
    • isThreadStatusAvailable

      boolean isThreadStatusAvailable()
      Get whether thread status information is available for this host
      Returns:
      true if thread status information is available, false otherwise
    • getRequiredModules

      Collection<IAnalysisModule> getRequiredModules(EnumSet<IHostModel.ModelDataType> requiredData)
      Get the analyses modules required to get the data requested
      Parameters:
      requiredData - An enum set of model data that will be useful to the caller
      Returns:
      A collection of analysis modules
    • dispose

      void dispose()
      Dispose of the model when it is not needed anymore