This file is indexed.

/usr/include/Aria/ArSystemStatus.h is in libaria-dev 2.8.0+repack-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
/*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology

     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.

     This program is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.

     You should have received a copy of the GNU General Public License
     along with this program; if not, write to the Free Software
     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

If you wish to redistribute ARIA under different terms, contact 
Adept MobileRobots for information about a commercial version of ARIA at 
robots@mobilerobots.com or 
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/

#ifndef ARSYSTEMSTATUS_H
#define ARSYSTEMSTATUS_H

#include "ariaTypedefs.h"
#include "ArFunctor.h"
#include "ariaUtil.h"
#include "ArMutex.h"
#include <string>

class ArSystemStatusRefreshThread;

/** @brief Utility to get statistics about the  host operating system
 *  (CPU usage, wireless link data, etc).
 *
 *  Normally, calling any accessor to read a value will query the operating
 *  system to get the most recent value.  However, if you will be accessing
 *  data very frequently and want those calls to be faster, you can start 
 *  a thread by calling startPeriodicUpdate() which will periodically query
 *  new values from the operating system and cache them for accessors to 
 *  return.
 *
 *  This class is only implemented for Linux; on Windows you will get invalid
 *  information.
 *  @todo Add a function and functor that formats uptime like "X years, 
 *  X months, X days, X hours, X min, X sec." (omitting 0 values).

  @ingroup UtilityClasses
 */
class ArSystemStatus {
public:

  /** Create a new thread which periodically invalidates cached data,
   *  causing it to be recalculated when next accessed.  Starting
   *  this thread is optional; start it if you 
   *  will be accessing the data frequently, so that is doesn't need to
   *  be re-read and re-calculated on each access. If you will only be 
   *  accessing the data occasionally, you do not need to start the update
   *  thread, it will be updated each time you read a value.
   */
  AREXPORT static void startPeriodicUpdate(int refreshFrequency = 5000, ArLog::LogLevel logLevel = ArLog::Verbose);

  /** Stop periodic update thread. Henceforth any access of data will
   *  cause it to be re-read and recalculated. */
  AREXPORT static void stopPeriodicUpdate();

  /** @deprecated use startPeriodicUpdate() which has a better name. */
  AREXPORT static void runRefreshThread(int refreshFrequency = 5000) {
    startPeriodicUpdate(refreshFrequency);
  }

  /** Get CPU work to idle ratio since last refresh.
   *  This is a value ranging from (0 .. 1) X (Num. CPUs). (Therefore
   *  if you have two CPUs, the maximum value will be 2.0, or 200%.)
   *  This value is calculated as the percentage 
   *  of time the CPU spent doing work (not in "idle" state) since the 
   *  previous calculation.
   *  @return CPU usage value, or -1 if unable to determine
   */
  AREXPORT static double getCPU();

  /** Get CPU usage as percentage since last refresh. This is a value ranging from
   *  (0..100) X (Num. CPUs). (Therefore if you have two CPUs, the maximum value
   *  will be 200%).
   *  @sa getCPU()
   *  @return CPU usage as percentage, or -1 if not able to determine
   */
  AREXPORT static double getCPUPercent();

  /// Get CPU percentage in a string
  AREXPORT static std::string getCPUPercentAsString();

  /// Get total system uptime (seconds)
  AREXPORT static unsigned long getUptime();

  /// Get program's uptime (seconds)
  AREXPORT static unsigned long getProgramUptime();

  /// Get total system uptime (hours)
  AREXPORT static double getUptimeHours();

  /// Get total system uptime in a string (hours)
  AREXPORT static std::string getUptimeHoursAsString();

  /** @return Pointer to a functor which can be used to retrieve the current CPU percentage */
  AREXPORT static ArRetFunctor<double>* getCPUPercentFunctor();

  /** @return Pointer to a functor which can be used to retrieve the current uptime (hours) */
  AREXPORT static ArRetFunctor<double>* getUptimeHoursFunctor();

  /** @return Pointer to a functor which can be used to retrieve the current uptime (hours) */
  AREXPORT static ArRetFunctor<unsigned long>* getUptimeFunctor();

  /** @return Pointer to a functor which can be used to retrieve the current uptime (hours) */
  AREXPORT static ArRetFunctor<unsigned long>* getProgramUptimeFunctor();



  /** Get wireless network general link quality heuristic (for first configured
   * wireless device). */
  AREXPORT static int getWirelessLinkQuality();

  /** Get wireless netork signal level (for first configured
   * wireless device). */
  AREXPORT static int getWirelessLinkSignal();

  /** Get wireless network noise level (for first configured
   * wireless device). */
  AREXPORT static int getWirelessLinkNoise();

  /** Get wireless network total discarded packets (for first configured
   * wireless device). */
  AREXPORT static int getWirelessDiscardedPackets();

  /** Get wireless network packets discarded because of a conflict with another
   * network (for first configured
   * wireless device). */
  AREXPORT static int getWirelessDiscardedPacketsBecauseNetConflict();


  AREXPORT static ArRetFunctor<int>* getWirelessLinkQualityFunctor();
  AREXPORT static ArRetFunctor<int>* getWirelessLinkNoiseFunctor();
  AREXPORT static ArRetFunctor<int>* getWirelessLinkSignalFunctor();

  /** @internal */
  AREXPORT static void invalidate();

  /** @deprecated Calling this function is no longer neccesary. */
  AREXPORT static void refresh() { } 
private:
  

  static ArMutex ourCPUMutex;
  static double ourCPU;
  static unsigned long ourUptime;
  static unsigned long ourFirstUptime;
  static unsigned long ourLastCPUTime;
  static ArTime ourLastCPURefreshTime;
  static ArGlobalRetFunctor<double> ourGetCPUPercentCallback;
  static ArGlobalRetFunctor<double> ourGetUptimeHoursCallback;
  static ArGlobalRetFunctor<unsigned long> ourGetUptimeCallback;
  static ArGlobalRetFunctor<unsigned long> ourGetProgramUptimeCallback;

  static ArMutex ourWirelessMutex;
  static int ourLinkQuality, ourLinkSignal, ourLinkNoise,
        ourDiscardedTotal, ourDiscardedDecrypt, ourDiscardedConflict;
  static ArGlobalRetFunctor<int> ourGetWirelessLinkQualityCallback;
  static ArGlobalRetFunctor<int> ourGetWirelessLinkNoiseCallback;
  static ArGlobalRetFunctor<int> ourGetWirelessLinkSignalCallback;

  static void refreshCPU(); ///< Refresh CPU, if neccesary
  static void refreshWireless(); ///< Refresh Wireless stats, if neccesary

  
  static ArSystemStatusRefreshThread* ourPeriodicUpdateThread;
  static bool ourShouldRefreshWireless;
  static bool ourShouldRefreshCPU;

};

#endif