Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

/root/resourcemonitord/resourcemonitord/ResourceMonitor/ResourceMonitor.h

Go to the documentation of this file.
00001 //
00002 // ResourceMonitor.h
00003 // 
00004 // This file declares the application interface to the resource monitor facility
00005 // ResourceMonitor library is designed to give a "C" consumer application access to the RM features.
00006 //
00007 
00008 
00009 /*M*
00010 BSD License
00011 
00012 Copyright (c) 2002, Intel Corporation
00013 All rights reserved.
00014 
00015 Redistribution and use in source and binary forms, with or without
00016 modification, are permitted provided that the following conditions are met:
00017 
00018   a.. Redistributions of source code must retain the above copyright notice,
00019       this list of conditions and the following disclaimer.
00020   b.. Redistributions in binary form must reproduce the above copyright notice,
00021       this list of conditions and the following disclaimer in the documentation
00022       and/or other materials provided with the distribution.
00023   c.. Neither the name of Intel Corporation nor the names of its contributors
00024       may be used to endorse or promote products derived from this software
00025       without specific prior written permission.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00028 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00029 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00030 DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00032 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00033 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00034 ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00035 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00036 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 
00038  *M*/
00039 
00040 #ifndef     __ResourceMonitor_h__
00041 #define __ResourceMonitor_h__
00042 
00043 #include "ResourceMonitorTypes.h"
00044 #include <stddef.h>
00045 
00046 #ifdef __cplusplus
00047 
00053 namespace ResourceMonitor
00054 {
00055 extern "C" {
00056 #endif
00057 
00558 
00559 int rmGetResourceMonitorVersion();
00560 
00561 //
00562 // Discovery of subsystems, resources, and statistics:
00563 //
00564 // These `GetAvailable` functions return information in the user's `buffer`about available
00565 // resources that can be monitored. The size parameter indiacted the number of structures
00566 // the buffer can hold. The return value EAGAIN indicates there are
00567 // more information structures available. A larger buffer is needed to retrieve them all.
00568 // 
00569 
00576 size_t rmGetSubsystemCount();
00588 int rmGetAvailableSubsystems(rmSubsystemInfo *buffer, const size_t size);
00601 int rmGetActiveResources(const rmUID SubsystemId, rmResourceInfo *buffer, const size_t size);
00613 int rmGetAvailableStatistics(const rmUID SubsystemId, rmStatisticInfo *buffer, const size_t size);
00620 size_t rmGetMonitorCount();
00630 int rmGetMonitors(rmMonitorInfo *buffer, size_t *size);
00637 int rmGetSubsystemInfo(const rmUID SubsystemId, rmSubsystemInfo *buffer);
00646 rmString rmGetSubsystemDescription(const rmUID SubsystemId, const enum rmDescriptions which);
00655 int rmGetResourceInfo(const rmUID SubsystemId, const rmID ResourceId, rmResourceInfo *buffer);
00666 rmString rmGetResourceDescription(const rmUID SubsystemId, const rmID ResourceId, const enum rmDescriptions which);
00675 int rmGetResourceID(const rmUID SubsystemId, const rmString shortdescription, rmID *id);
00684 int rmGetStatisticInfo(const rmUID SubsystemId, const rmID statId, rmStatisticInfo *buffer);
00695 rmString rmGetStatisticDescription(const rmUID SubsystemId, const rmID statId, const enum rmDescriptions which);
00704 int rmGetStatisticID(const rmUID SubsystemId, const rmString shortdescription, rmID *id);
00705 
00706 #ifdef RM_Doing_Aliases
00707 // can client applications establish aliases? If so should the RM facility persist them?
00708 
00709 int rmGetSubsystemAliases(const rmUID SubsystemId, rmString buffer, size_t *size);
00710 
00711 int rmGetResourceAliases(const rmUID SubsystemId, const rmID ResourceId, rmString buffer, size_t *size);
00712 
00713 int rmGetStatisticAliases(const rmStatisticKey statisticKey, rmString buffer, size_t* size);
00714 #endif  // RM_Doing_Aliases
00715 
00716 //
00717 // query statistic values without creating a monitor
00718 //
00728 int rmGetCurrentValue(const rmStatisticKey id, rmValue *value);
00736 int rmGetUpperBound(const rmStatisticKey id, rmValue *value);
00737 
00746 int rmResetCounterStatistic(const rmStatisticKey id, const rmValue *value);
00747 
00771 rmHandle rmCreateMonitor(const rmMonitorConfiguration *config, rmMonitorControl *control);
00780 rmHandle rmAccessMonitor(const rmUID MonitorId);
00786 int rmDeleteMonitor(const rmHandle handle);
00792 int rmGetMonitorControl(const rmHandle handle, rmMonitorControl *control);
00805 int rmSetMonitorControl(const rmHandle handle, const rmMonitorControl *control);
00811 int rmGetMonitorConfiguration(const rmHandle handle, rmMonitorConfiguration *config);
00823 int rmSetMonitorConfiguration(const rmHandle handle, const rmMonitorConfiguration *config);
00830 int rmStartMonitor(const rmHandle handle);
00836 int rmStopMonitor(const rmHandle handle);
00844 int rmResetMonitor(const rmHandle handle);
00851 int rmPauseNotification(const rmHandle handle);
00859 int rmResetNotification(const rmHandle handle);
00866 int rmGetMonitorState(const rmHandle handle, rmMonitorState *state);
00873 int rmGetMonitorInfo(const rmHandle handle, rmMonitorInfo *info );
00882 rmString rmGetMonitorDescription(const rmHandle handle, const enum rmDescriptions which);
00890 int rmSetMonitorDescription(const rmHandle handle, const enum rmDescriptions which, const rmString description);
00891 
00892 #ifdef RM_Doing_Groups
00893 //
00894 // Statistic groups are for gathering many values in a single call
00895 // ie  rmGetStatisticValues
00896 //
00897 rmHandle rmCreateStatisticGroup();
00898 
00899 int rmDeleteStatisticGroup(rmHandle grpHandle);
00900 
00901 int rmAddStatisticToGroup( rmHandle grpHandle, rmStatisticKey *stat );
00902 
00903 int rmDeleteStatisticFromGroup( rmHandle grpHandle, rmStatisticKey * stat );
00904 
00905 size_t rmGetStatisticGroupCount(rmHandle grpHandle);
00906 
00907 int rmGetStatisticValues(rmHandle grpHandle, rmStatisticValue *values, size_t count);
00908 
00909 int rmGetStatisticsInfo( rmHandle grpHandle, rmStatisticInfo *buffer, size_t count);
00910 
00911 //
00912 // Monitor groups are for controlling and gathering state of many monitors in a single call
00913 // ie  rmGetMonitorStates, rmStartMonitors, etc.
00914 //
00915 rmHandle rmCreateMonitorGroup();
00916 
00917 int rmDeleteMonitorGroup(rmHandle grpHandle);
00918 // removes user's monitor group and invalidates the monitor's group rmHandle;
00919 // This has no effect on the individual monitors. individual monitors must also
00920 // be deleted if desired.
00921 
00922 int rmAddMonitorToGroup( rmHandle grphandle, rmHandle monitorHandle );
00923 
00924 int rmDeleteMonitorFromGroup( rmHandle grpHandle, rmHandle monitorHandle );
00925 
00926 size_t rmGetMonitorGroupCount(rmHandle grpHandle);
00927 
00928 int rmGetMonitorStates( rmHandle grpHandle, rmMonitorState *state, size_t count);
00929 
00930 int rmStartMonitors(rmHandle grpHandle);
00931 
00932 int rmStopMonitors(rmHandle grpHandle);
00933 
00934 int rmPauseNotifications(rmHandle grpHandle);
00935 
00936 int rmResetMonitors(rmHandle grpHandle);  // clears current watermark info
00937 #endif  // RM_Doing_Groups
00938 
00939 #ifdef __cplusplus
00940 }   // extern "C"
00941 
00946 typedef void * rmSessionHandle;
00947 
00956 rmSessionHandle rmCreateConsumerSession();
00957 
00963 int rmCloseConsumerSession(const rmSessionHandle handle);
00964 
00965 class RMsession
00966 {
00967 public:
00968     RMsession();
00970     RMsession(rmSessionHandle handle);
00971     ~RMsession();
00972     rmSessionHandle getConsumerHandle() const;
00975     void setSessionHandle(rmSessionHandle a_SessionHandle);
00976 protected:
00977     rmSessionHandle m_SessionHandle;
00978 };
00979 
00987 class RMdiscovery : virtual public RMsession
00988 {
00989 public:
00990     RMdiscovery();
00992     RMdiscovery(const rmSessionHandle session);
00993     ~RMdiscovery();
00995     size_t GetSubsystemCount() const;
00997     int GetAvailableSubsystems(rmSubsystemInfo *buffer, const size_t size) const;
00999     int GetActiveResources( const rmUID &uuid, rmResourceInfo *buffer, const size_t size) const;
01001     int GetAvailableStatistics( const rmUID &uuid, rmStatisticInfo *buffer, const size_t size) const;
01003     size_t GetMonitorCount() const;
01005     int GetMonitors(rmMonitorInfo *buffer, size_t *size) const;
01006 };
01007 
01014 class RMsubsystem : virtual public RMsession
01015 {
01016 public:
01017     RMsubsystem(const rmUID &SubsystemId);
01019     RMsubsystem(const rmSessionHandle session, const rmUID &SubsystemId);
01020     ~RMsubsystem();
01021     void GetSubsystemId(rmUID &uuid) const;
01023     int GetSubsystemInfo( rmSubsystemInfo *buffer) const;
01025     rmString GetSubsystemDescription(rmDescriptions which) const;
01026 //  RMresource GetResource(rmid id);
01027 #ifdef RM_Doing_Aliases
01028     int GetSubsystemAliases( rmString buffer, size_t *size) const;
01029 #endif  // RM_Doing_Aliases
01030 
01031 protected:
01032     RMsubsystem();
01033     RMsubsystem(const rmSessionHandle session);
01034     void SetSubsystemId(const rmUID &uuid);
01035     rmUID m_subsystemId;
01036 };  //RMsubsystem
01037 
01038 
01045 class RMresource : public RMsubsystem
01046 {
01047 public:
01048     RMresource(const rmUID &SubsystemId, const rmID ResourceId);
01049     RMresource(const rmSessionHandle session, const rmUID &SubsystemId, const rmID ResourceId);
01050     ~RMresource();
01051     rmID GetResourceId() const;
01053     int GetResourceInfo( rmResourceInfo *buffer) const;
01055     rmString GetResourceDescription(rmDescriptions which) const;
01056 //  RMstatistic GetStatistic(rmid id);
01057 #ifdef RM_Doing_Aliases
01058     int GetResourceAliases( rmString buffer, size_t *size) const;
01059 #endif  // RM_Doing_Aliases
01060 protected:
01061     RMresource();
01062     RMresource(const rmSessionHandle session);
01063     void SetResourceId(const rmID id);
01064     rmID m_resourceId;
01065 };  //RMresource
01066 
01073 class RMstatistic : public RMresource
01074 {
01075 public:
01076     RMstatistic(const rmStatisticKey &stat);
01077     RMstatistic(const rmSessionHandle session, const rmStatisticKey &stat);
01078     ~RMstatistic();
01080   void GetStatisticId(rmStatisticKey *statisticKey) const;
01081   rmID GetStatisticId() const;
01083     int GetValue(rmValue *val) const;
01085     int GetUpperBound(rmValue *val) const;
01087     int ResetCounterStatistic(rmValue *val);        // not valid for guages
01089   int GetStatisticInfo( rmStatisticInfo *buffer) const;
01091     rmString GetStatisticDescription(const rmDescriptions which) const;
01092 #ifdef RM_Doing_Aliases
01093     int GetStatisticAliases( rmString buffer, size_t *size) const;
01094 #endif  // RM_Doing_Aliases
01095 protected:
01096     RMstatistic();
01097     RMstatistic(const rmSessionHandle session);
01098   void SetStatisticId(const rmStatisticKey &statisticKey);
01099   void SetStatisticId(const rmID id);
01100     rmID     m_statisticId;
01101 };  //    RMstatistic
01102 
01110 class RMmonitor : public RMstatistic
01111 {
01112 public:
01115     RMmonitor(const rmMonitorConfiguration &config, rmMonitorControl *control);
01118     RMmonitor(const rmUID MonitorId);
01121     RMmonitor(const rmSessionHandle session, const rmMonitorConfiguration &config, rmMonitorControl *control);
01124     RMmonitor(const rmSessionHandle session, const rmUID MonitorId);
01127     ~RMmonitor();
01130     void OnDestructionDeleteMonitor();
01132     int GetMonitorControl( rmMonitorControl *control) const;
01134     int SetMonitorControl( const rmMonitorControl &control);
01136     int GetMonitorConfiguration( rmMonitorConfiguration *config) const;
01138     int SetMonitorConfiguration( const rmMonitorConfiguration &config);
01140     int GetMonitorState( rmMonitorState *state) const;
01142     int GetMonitorInfo( rmMonitorInfo *buffer ) const;
01144     rmString GetMonitorDescription(const rmDescriptions which) const;
01146     int SetMonitorDescription(const rmDescriptions which, const rmString description);
01148     int StartMonitor();
01150     int StopMonitor();
01152     int ResetMonitor();
01154     int PauseNotification();
01156     int ResetNotification();
01157 private:
01158     rmHandle m_MonitorHandle;
01159     bool m_deleteInDestructor;
01160 };
01161 
01162 // END CLASS DEFINITION RMmonitor
01163 
01164 #ifdef RM_Doing_Groups
01165 class RMstatisticGroup
01166 {
01167 public:
01168     RMstatisticGroup();
01169     ~RMstatisticGroup();
01170     int AddStatistic( rmStatisticKey& stat );
01171     int DeleteStatistic( rmStatisticKey &stat );
01172     size_t GetStatisticCount();
01173     int GetValues( rmStatisticValue *values, size_t count);
01174     int GetStatisticInfo( rmStatisticInfo *buffer, size_t count);
01175 private:
01176     rmHandle m_GroupHandle;
01177 };  //RMstatisticGroup
01178 
01179 
01180 class RMmonitorGroup
01181 {
01182 public:
01183     RMmonitorGroup();
01184     ~RMmonitorGroup();
01185     int AddMonitor( RMmonitor & monitor );
01186     int DeleteMonitor( RMmonitor &monitor );
01187     size_t GetMonitorCount();
01188     int GetStates( rmMonitorState *state, size_t count) ;
01189     int StartMonitors();
01190     int StopMonitors();
01191     int PauseNotifications();
01192     int ResetMonitors();
01193 private:
01194     rmHandle m_GroupHandle;
01195 };  //RMmonitorGroup
01196 #endif  // RM_Doing_Groups
01197 
01198 }   //ResourceMonitor
01199 #endif  //  __cplusplus
01200 
01201 #endif  //  __ResourceMonitor_h__

Generated at Sat Sep 7 21:21:07 2002 for Resource Monitoring Facility by doxygen1.2.8.1 written by Dimitri van Heesch, © 1997-2001