75 #ifdef HPCTOOLKIT_PROFILE 102 mainPortNumber = socketptr->
getPort();
103 cout <<
"Received connection" << endl;
105 int command = socketptr->
readInt();
111 if (xmlPortNumber == 1)
114 if (xmlPortNumber != mainPortNumber)
121 xmlSocketPtr = socketptr;
131 if (xmlPortNumber != mainPortNumber)
133 delete (xmlSocketPtr);
138 cerr <<
"Expected an open command, got " << command << endl;
151 #ifdef HPCTOOLKIT_PROFILE 154 controller = parseOpenDB(socketptr);
156 if (controller ==
NULL)
158 cout <<
"Could not open database" << endl;
159 sendDBOpenFailed(socketptr);
162 int tag = socketptr->
readInt();
170 DEBUGCOUT(1) <<
"Database opened" << endl;
171 sendDBOpenedSuccessfully(socketptr, xmlSocket);
174 int Message = socketptr->
readInt();
176 parseInfo(socketptr);
178 cerr <<
"Did not receive info packet" << endl;
180 #ifdef HPCTOOLKIT_PROFILE 190 int nextCommand = socketptr->
readInt();
194 #ifdef HPCTOOLKIT_PROFILE 197 getAndSendData(socketptr);
198 #ifdef HPCTOOLKIT_PROFILE 203 #ifdef HPCTOOLKIT_PROFILE 207 #ifdef HPCTOOLKIT_PROFILE 216 cerr <<
"Unknown command received" << endl;
228 int headerSize = socket->
readInt();
229 controller->setInfo(minBegTime, maxEndTime, headerSize);
231 Communication::sendParseInfo(minBegTime, maxEndTime, headerSize);
238 int actualXMLPort = xmlSocket->
getPort();
241 int numFiles = controller->getNumRanks();
248 compressionType = useCompression ? 1 : 0;
252 int* rankProcessIds = controller->getValuesXProcessID();
253 short* rankThreadIds = controller->getValuesXThreadID();
254 for (
int i = 0; i < numFiles; i++)
256 socket->
writeInt(rankProcessIds[i]);
262 cout <<
"Waiting to send XML on port " << actualXMLPort << endl;
263 if (actualXMLPort != mainPortNumber)
276 int uncompressedFileSize = FileUtils::getFileSize(controller->getExperimentXML());
280 ProgressBar prog(
"Compressing XML", uncompressedFileSize);
281 FILE* in = fopen(controller->getExperimentXML().c_str(),
"r");
284 compressor.zalloc = Z_NULL;
285 compressor.zfree = Z_NULL;
286 compressor.opaque = Z_NULL;
289 int ret = deflateInit2(&compressor, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 16+15, 8, Z_DEFAULT_STRATEGY);
298 DEBUGCOUT(2)<<
"Compressed XML Size: "<<compressedSize<<endl;
300 xmlSocket->
writeInt(compressedSize);
305 cout <<
"XML Sent" << endl;
310 int clientProtocolVersion = receiver->
readInt();
312 if (clientProtocolVersion != SERVER_PROTOCOL_MAX_VERSION)
313 cout <<
"The client is using protocol version 0x" << hex << clientProtocolVersion<<
314 " and the server supports version 0x" << SERVER_PROTOCOL_MAX_VERSION << endl;
316 if (clientProtocolVersion < SERVER_PROTOCOL_MAX_VERSION) {
317 cout <<
"Warning: The server is running in compatibility mode." << endl;
318 agreedUponProtocolVersion = clientProtocolVersion;
320 else if (clientProtocolVersion > SERVER_PROTOCOL_MAX_VERSION) {
321 cout <<
"The client protocol version is not supported by this server."<<
322 "Please upgrade the server. This session may be buggy and problematic." << endl;
323 agreedUponProtocolVersion = SERVER_PROTOCOL_MAX_VERSION;
330 checkProtocolVersions(receiver);
334 cout <<
"Opening database: " << pathToDB << endl;
337 if (controller !=
NULL)
339 Communication::sendParseOpenDB(pathToDB);
358 int processStart = stream->
readInt();
359 int processEnd = stream->
readInt();
362 int verticalResolution = stream->
readInt();
363 int horizontalResolution = stream->
readInt();
365 DEBUGCOUT(2) <<
"Time end: " << timeEnd <<endl;
368 if ((processStart < 0) || (processEnd<0) || (processStart > processEnd)
369 || (verticalResolution<0) || (horizontalResolution<0)
370 || (timeEnd < timeStart))
373 <<
"A data request with invalid parameters was received. This sometimes happens if the client shuts down in the middle of a request. The server will now shut down." 377 Communication::sendStartGetData(controller, processStart, processEnd, timeStart, timeEnd, verticalResolution, horizontalResolution);
383 ProgressBar prog(
"Computing traces", min(processEnd - processStart, verticalResolution));
385 Communication::sendEndGetData(stream, &prog, controller);
392 bool excludeMatches = stream->
readByte();
394 Communication::sendStartFilter(count, excludeMatches);
396 for (
int i = 0; i < count; ++i) {
407 Communication::sendFilter(filt);
411 controller->applyFilters(filters);
virtual void writeShort(short)
virtual void writeInt(int)
unsigned char * getOutputBuffer()
SpaceTimeDataController * openDbAndCreateStdc(string)
virtual void writeRawData(char *, int)
#define LOGTIMESTAMPEDMSG(msg)