/****************************************************************************/
/* Copyright (c) 2011 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  : Driver task that gathers data on system resource use          */
/* Filename : SysData.h                                                     */
/* Author   : Rich Henthorn                                                 */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 01/18/2011                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#ifndef SYSDATA_H
#define SYSDATA_H

#include "sysmon.h"
#include "PeriodicTask.h"
#include "SysDataProcess.h"
#include "SysDataCpuPrio.h"
#include "SysDataMemPrio.h"

//struct prioTotalsT;

class SysData : public PeriodicTask {

  friend class SysDataCpuPrio;
  friend class SysDataMemPrio;
  friend class SysDataProcess;

public:

  SysData(unsigned int freq = 1);
  ~SysData();

  void verbose(Boolean flag);
  void cpu_usage(Boolean flag);
  void mem_usage(Boolean flag);
  void frequency(unsigned int);
  void monitorProcess(char *processName);


  ////////////////////////////////////////////////////////////////////
  // Initialize device. Returned DeviceIF::Status
  // will be propagated to subscribers in other tasks.
  void initialize();
  void startSampling();
  void readData();

protected:

  // Data log for tracking cpu usage by priority during a mission.
  // Create new log classes for tracking other system resources in the future.
  //
  SysDataCpuPrio  *_cpulog;
  SysDataMemPrio  *_memlog;
  SysDataProcess  *_processlog;

  struct prioTotalsT *_prioTotals;

  // Operational variables
  //
  unsigned int _freq;
  int _pass;
  Boolean _verbose;
  Boolean _cpuusage;
  Boolean _memusage;
  char* _processNames[50];
  short _process_cpu[50];
  short _process_mem[50];
};

#endif
