PacMan 2.0(r200)
Runs on digital PAC measurement computers

PacStats.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008-2010 by Matthias Nagl                              *
00003  *   mnagl@uni-goettingen.de                                               *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #ifndef PACSTATS_H
00022 #define PACSTATS_H
00023 #include <QObject>
00024 #include <QCoreApplication>
00025 #include <QTimer>
00026 #include "PacMan.h"
00027 #ifdef Q_OS_UNIX
00028 #include <ncursesw/curses.h>
00029 #else
00030 #include <curses.h>
00031 #endif
00032 #include <iostream>
00033 
00039 class PacStats : public QObject
00040 {
00041     Q_OBJECT
00042   public:
00043     PacStats(QObject *parent = 0);
00044     ~PacStats();
00045     static void debugMessageHandler(QtMsgType type, const char *msg) {
00046       if (type == QtFatalMsg && PacMan::pacstats!=0) {
00047         delete PacMan::pacstats;
00048         std::cout << msg << std::endl;
00049       }
00050       else
00051         wprintw(PacStats::debugwin, "%s\n", msg);
00052     }
00053     static WINDOW *statwin, *titlewin, *debugwin, *referencewin;
00054 
00055   public slots:
00056     void showDigitizerStats(long recevents);
00057     void showAnalyzerStats(int dataqueuewfin, int dataqueuewfdrop, int resultqueuein, int resultqueuedrop);
00058     void showNetComState(QString s);
00059     void showNetComStats(qulonglong sentbytes);
00060 
00061   private slots:
00062     void printStats();
00063 
00064   signals:
00065     void updateNetComState();
00066 
00067   private:
00068     void prepareStatWin();
00069     void prepareTitleWin();
00070     void prepareReferenceWin();
00071     void print6CharStatValue(long val, int y, int x);
00072     long recevents;
00073     int dataqueuewfin, dataqueuewfdrop, resultqueuein, resultqueuedrop;
00074     long sentbytes;
00075     QString netcomstate;
00076     QTimer *t;
00077     int height, width;
00078     static const int statheight, titleheight;
00079     int referenceheight;
00080 };
00081 
00082 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends