[go: up one dir, main page]

Menu

[r52]: / client / speclient.h  Maximize  Restore  History

Download this file

118 lines (88 with data), 2.8 kB

  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
/*****************************************************************************
Copyright © 2006, 2007, The Board of Trustees of the University of Illinois.
All Rights Reserved.
National Center for Data Mining (NCDM)
University of Illinois at Chicago
http://www.ncdm.uic.edu/
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., 51
Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
written by
Yunhong Gu [gu@lac.uic.edu], last updated 05/22/2007
*****************************************************************************/
#ifndef __SECTOR_H__
#define __SECTOR_H__
#include "client.h"
#include <string>
#include <pthread.h>
#include <transport.h>
using namespace std;
namespace cb
{
class Process
{
friend class Client;
public:
Process();
~Process();
int open(vector<string> stream, string op, const char* param = NULL, const int& size = 0);
int close();
int run();
int checkProgress();
int read(char*& data, int& size, string& file, int64_t& offset, int& rows, const bool& inorder = true, const bool& wait = true);
private:
string m_strOperator;
char* m_pcParam;
int m_iParamSize;
vector<string> m_vstrStream;
struct DS
{
string m_strDataFile;
int64_t m_llOffset;
int64_t m_llSize;
int m_iSPEID;
int m_iStatus; // 0: not started yet; 1: in progress; 2: done, result ready; 3: result read
char* m_pcResult;
int m_iResSize;
};
vector<DS> m_vDS;
struct SPE
{
uint32_t m_uiID;
string m_strIP;
int m_iPort;
DS* m_pDS;
int m_iStatus; // -1: bad; 0: ready; 1; running
int m_iProgress;
timeval m_StartTime;
timeval m_LastUpdateTime;
Transport m_DataChn;
};
vector<SPE> m_vSPE;
int m_iProgress;
int m_iAvgRunTime;
int m_iTotalDS;
int m_iTotalSPE;
int m_iAvailRes;
pthread_mutex_t m_ResLock;
pthread_cond_t m_ResCond;
int m_iMinUnitSize;
int m_iMaxUnitSize;
CGMP m_GMP;
private:
static void* run(void*);
int checkSPE();
int startSPE(SPE& s);
};
}; // namespace cb
#endif