perfsrv/analyzetool/commandlineengine/src/CATParseTraceFile.cpp
changeset 55 f2950aff7424
parent 48 516af714ebb4
equal deleted inserted replaced
48:516af714ebb4 55:f2950aff7424
    80 			return bRet;
    80 			return bRet;
    81 		}
    81 		}
    82 	}
    82 	}
    83 
    83 
    84 	// Open data file
    84 	// Open data file
    85 	ifstream in( pFileName );
    85 	ifstream in( pFileName, ios::binary );
    86 
    86 
    87 	// Check file opened ok
    87 	// Check file opened ok
    88 	if ( !in.good() )
    88 	if ( !in.good() )
    89 		return false;
    89 		return false;
    90 
    90 
   282 				continue;
   282 				continue;
   283 
   283 
   284 			// get time string from timestamp
   284 			// get time string from timestamp
   285 			sTime = GetTimeFromTimeStamp( iTimeStamp, vProcessList[iProcessIDinList].iTimeSpan );
   285 			sTime = GetTimeFromTimeStamp( iTimeStamp, vProcessList[iProcessIDinList].iTimeSpan );
   286 
   286 
   287 			// TODO version with reallocation
   287 			if( bCreateCleanedTraces )
   288 			//cleanedTraces << sTime << " "; //add time
   288 			{
   289 			//cleanedTraces << sLineToCleanedFile << "\n"; //add the rest of the line
   289 					cleanedTraces << sTime << " "; //add time
   290 
   290 					cleanedTraces << sLineToCleanedFile << "\n"; //add the rest of the line
   291 			// "Old style" allocation (< v.1.6)
   291 			}
   292 			if( ! _stricmp( pCommand, ALLOC_ID ) )
   292 
       
   293 			// Allocation header
       
   294 			if ( ! _stricmp( pCommand, ALLOCH_ID ) )
   293 			{
   295 			{
   294 				// Add alloc
   296 				// Add alloc
   295 				vProcessList[iProcessIDinList].Alloc( sRestOfLine );
   297 				vProcessList[iProcessIDinList].AllocH( sRestOfLine, sTime );
   296 
   298 
   297 				// Subtests running?
   299 				// Subtests running?
   298 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   300 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   299 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
   301 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
   300 				{
   302 				{
   301 					if( viSubTestIter->bRunning )
   303 					if( viSubTestIter->bRunning )
   302 					{
   304 					{
   303 						// Save alloc also to sub test
   305 						// Save alloc also to sub test
   304 						viSubTestIter->Alloc( sRestOfLine );
       
   305 					}
       
   306 					viSubTestIter++;
       
   307 				}
       
   308 			}
       
   309 			else if ( ! _stricmp( pCommand, ALLOCH_ID ) )
       
   310 			{
       
   311 				if( bCreateCleanedTraces )
       
   312 				{
       
   313 				// add message to cleaned traces file
       
   314 				cleanedTraces << sTime << " "; //add time
       
   315 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   316 				cleanedTraces << sProcessID << " "; //add process ID
       
   317 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   318 				}
       
   319 
       
   320 				// Add alloc
       
   321 				vProcessList[iProcessIDinList].AllocH( sRestOfLine, sTime );
       
   322 
       
   323 				// Subtests running?
       
   324 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
       
   325 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
       
   326 				{
       
   327 					if( viSubTestIter->bRunning )
       
   328 					{
       
   329 						// Save alloc also to sub test
       
   330 						viSubTestIter->AllocH( sRestOfLine, sTime );
   306 						viSubTestIter->AllocH( sRestOfLine, sTime );
   331 					}
   307 					}
   332 					viSubTestIter++;
   308 					viSubTestIter++;
   333 				}
   309 				}
   334 			}
   310 			}
   335 			// Allocation fragment (call stack).
   311 			// Allocation fragment (call stack).
   336 			else if ( ! _stricmp( pCommand, ALLOCF_ID ) )
   312 			else if ( ! _stricmp( pCommand, ALLOCF_ID ) )
   337 			{
   313 			{
   338 				if( bCreateCleanedTraces )
       
   339 				{
       
   340 				// add message to cleaned traces file
       
   341 				cleanedTraces << sTime << " "; //add time
       
   342 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   343 				cleanedTraces << sProcessID << " "; //add process ID
       
   344 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   345 				}
       
   346 
       
   347 				// Add alloc fragment
   314 				// Add alloc fragment
   348 				vProcessList[iProcessIDinList].AllocF( sRestOfLine, sTime );
   315 				vProcessList[iProcessIDinList].AllocF( sRestOfLine, sTime );
   349 				
   316 				
   350 				// Subtests running?
   317 				// Subtests running?
   351 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   318 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   357 						viSubTestIter->AllocF( sRestOfLine, sTime );
   324 						viSubTestIter->AllocF( sRestOfLine, sTime );
   358 					}
   325 					}
   359 					viSubTestIter++;
   326 					viSubTestIter++;
   360 				}
   327 				}
   361 			}
   328 			}
       
   329 			//Reallocation header
   362 			else if ( ! _stricmp( pCommand, REALLOCH_ID ) )
   330 			else if ( ! _stricmp( pCommand, REALLOCH_ID ) )
   363 			{
   331 			{
       
   332 				// todo add reallocation flag?
       
   333 
       
   334 				string sFreeLine = "";
       
   335 				string sAllocLine = "";
       
   336 
   364 				// Add free
   337 				// Add free
   365 
   338 
   366 				// get 'free' line from realloc line
   339 				// get 'free' line from realloc line
   367 				string sFreeRestOfLine = sRestOfLine;
   340 				string sFreeRestOfLine = sRestOfLine;
   368 				string sFreeLine = "";
   341 
   369 				sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
   342 				sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
   370 				sFreeLine.append( " " );
   343 				sFreeLine.append( " " );
   371 				// next two strings are for 'alloc' (address and size) - lets remove them
   344 				// next two strings are for 'alloc' (address and size) - lets remove them
   372 				GetStringUntilNextSpace( sFreeRestOfLine, true );
   345 				GetStringUntilNextSpace( sFreeRestOfLine, true );
   373 				GetStringUntilNextSpace( sFreeRestOfLine, true );
   346 				GetStringUntilNextSpace( sFreeRestOfLine, true );
   374 				// add rest of line to 'free' line
   347 				// add rest of line to 'free' line
   375 				sFreeLine.append( sFreeRestOfLine );
   348 				sFreeLine.append( sFreeRestOfLine );
   376 				//add 'free' line
   349 				//add 'free' line
   377 				vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
   350 				vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
   378 
   351 
   379 				if( bCreateCleanedTraces )
       
   380 				{
       
   381 				// add message to cleaned traces file
       
   382 				// construct 'free' header trace
       
   383 				cleanedTraces << sTime << " "; //add time
       
   384 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   385 				cleanedTraces << sProcessID << " "; //add process ID
       
   386 				cleanedTraces << FREEH_ID << " "; //add FRH
       
   387 				cleanedTraces << sFreeLine << "\n"; //add the rest of the line
       
   388 				}
       
   389 
       
   390 				// Add alloc
   352 				// Add alloc
   391 
   353 
   392 				//get 'alloc' line from realloc line
   354 				//get 'alloc' line from realloc line
   393 				// only first string is unnecessary, lets remove it
   355 				// first string is for 'free' (address), lets remove it first
   394 				GetStringUntilNextSpace( sRestOfLine );
   356 				GetStringUntilNextSpace( sRestOfLine );
       
   357 				sAllocLine = sRestOfLine;
   395      			// add 'alloc' line
   358      			// add 'alloc' line
   396 				vProcessList[iProcessIDinList].AllocH( sRestOfLine, sTime );
   359 				vProcessList[iProcessIDinList].AllocH( sAllocLine, sTime );
   397 
       
   398 				if( bCreateCleanedTraces )
       
   399 				{
       
   400 				// add message to cleaned traces file
       
   401 				// construct 'alloc' header trace
       
   402 				cleanedTraces << sTime << " "; //add time
       
   403 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   404 				cleanedTraces << sProcessID << " "; //add process ID
       
   405 				cleanedTraces << ALLOCH_ID << " "; //add FRH
       
   406 				cleanedTraces << sRestOfLine << "\n"; //add the rest of the line
       
   407 				}
       
   408 
   360 
   409 				// Subtests running?
   361 				// Subtests running?
   410 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   362 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   411 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
   363 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
   412 				{
   364 				{
   413 					if( viSubTestIter->bRunning )
   365 					if( viSubTestIter->bRunning )
   414 					{
   366 					{
   415 						// Save realloc also to sub test
   367 						// Save realloc also to sub test
   416 						// Add free
   368 
   417 
       
   418 						// get 'free' line from realloc line
       
   419 						string sFreeRestOfLine = sRestOfLine;
       
   420 						string sFreeLine = "";
       
   421 						sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
       
   422 						sFreeLine.append( " " );
       
   423 						// next two strings are for 'alloc' (address and size) - lets remove them
       
   424 						GetStringUntilNextSpace( sFreeRestOfLine, true );
       
   425 						GetStringUntilNextSpace( sFreeRestOfLine, true );
       
   426 						// add rest of line to 'free' line
       
   427 						sFreeLine.append( sFreeRestOfLine );
       
   428 						//add 'free' line
   369 						//add 'free' line
   429 						vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
   370 						vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
   430 
   371 
   431 						// Add alloc
       
   432 
       
   433 						//get 'alloc' line from realloc line
       
   434 						// only first string is unnecessary, lets remove it
       
   435 						GetStringUntilNextSpace( sRestOfLine );
       
   436      					// add 'alloc' line
   372      					// add 'alloc' line
   437 						vProcessList[iProcessIDinList].AllocH( sRestOfLine, sTime );
   373 						vProcessList[iProcessIDinList].AllocH( sAllocLine, sTime );
   438 					}
   374 					}
   439 					viSubTestIter++;
   375 					viSubTestIter++;
   440 				}
   376 				}
   441 			}
   377 			}
   442 			// rellocation fragment (call stack).
   378 			// rellocation fragment (call stack)
   443 			else if ( ! _stricmp( pCommand, REALLOCF_ID ) )
   379 			else if ( ! _stricmp( pCommand, REALLOCF_ID ) )
   444 			{
   380 			{
       
   381 				string sFreeLine = "";
       
   382 				string sAllocLine = "";
       
   383 
       
   384 				// Not used currently.
       
   385 				/*
   445 				// Add free fragment 
   386 				// Add free fragment 
   446 
   387 
   447 				// get 'free' line from realloc line
   388 				// get 'free' line from realloc line
   448 				string sFreeRestOfLine = sRestOfLine;
   389 				string sFreeRestOfLine = sRestOfLine;
   449 				string sFreeLine = "";
       
   450 				sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
   390 				sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
   451 				sFreeLine.append( " " );
   391 				sFreeLine.append( " " );
   452 				// next string is for 'alloc' (address) - lets remove it
   392 				// next string is for 'alloc' (address) - lets remove it
   453 				GetStringUntilNextSpace( sFreeRestOfLine, true );
   393 				GetStringUntilNextSpace( sFreeRestOfLine, true );
   454 				// add rest of line to 'free' line
   394 				// add rest of line to 'free' line
   455 				sFreeLine.append( sFreeRestOfLine );
   395 				sFreeLine.append( sFreeRestOfLine );
       
   396 
   456 				//add 'free' line
   397 				//add 'free' line
   457 				vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
   398 				vProcessList[iProcessIDinList].FreeF( sFreeLine, sTime );
   458 
   399 				*/
   459 				if( bCreateCleanedTraces )
       
   460 				{
       
   461 				// add message to cleaned traces file
       
   462 				// construct 'free' fragment trace
       
   463 				cleanedTraces << sTime << " "; //add time
       
   464 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   465 				cleanedTraces << sProcessID << " "; //add process ID
       
   466 				cleanedTraces << FREEF_ID << " "; //add FRF
       
   467 				cleanedTraces << sFreeLine << "\n"; //add the rest of the line
       
   468 				}
       
   469 
   400 
   470 				// Add alloc fragment
   401 				// Add alloc fragment
   471 
   402 
   472 				// first string is for 'free' (address), lets remove it first
   403 				// first string is for 'free' (address), lets remove it first
   473 				GetStringUntilNextSpace( sRestOfLine, true );
   404 				GetStringUntilNextSpace( sRestOfLine, true );
       
   405 				sAllocLine = sRestOfLine;
   474 				//add 'alloc' line
   406 				//add 'alloc' line
   475 				vProcessList[iProcessIDinList].AllocF( sRestOfLine, sTime );
   407 				vProcessList[iProcessIDinList].AllocF( sAllocLine, sTime );
   476 
       
   477 				if( bCreateCleanedTraces )
       
   478 				{
       
   479 				// add message to cleaned traces file
       
   480 				// construct 'alloc' fragment trace
       
   481 				cleanedTraces << sTime << " "; //add time
       
   482 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   483 				cleanedTraces << sProcessID << " "; //add process ID
       
   484 				cleanedTraces << ALLOCF_ID << " "; //add FRF
       
   485 				cleanedTraces << sRestOfLine << "\n"; //add the rest of the line
       
   486 				}
       
   487 				
   408 				
   488 				// Subtests running?
   409 				// Subtests running?
   489 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   410 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   490 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
   411 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
   491 				{
   412 				{
   492 					if( viSubTestIter->bRunning )
   413 					if( viSubTestIter->bRunning )
   493 					{
   414 					{
   494 						// Save alloc fragment also to sub test
   415 						// Save realloc fragment also to sub test
   495 						// Add free fragment 
   416 
   496 
   417 						// Not used currently.
   497 						// get 'free' line from realloc line
   418 						/*
   498 						string sFreeRestOfLine = sRestOfLine;
       
   499 						string sFreeLine = "";
       
   500 						sFreeLine.append( GetStringUntilNextSpace( sFreeRestOfLine, true ) ); //append freed memory address
       
   501 						sFreeLine.append( " " );
       
   502 						// next string is for 'alloc' (address) - lets remove it
       
   503 						GetStringUntilNextSpace( sFreeRestOfLine, true );
       
   504 						// add rest of line to 'free' line
       
   505 						sFreeLine.append( sFreeRestOfLine );
       
   506 						//add 'free' line
   419 						//add 'free' line
   507 						vProcessList[iProcessIDinList].FreeH( sFreeLine, sTime );
   420 						vProcessList[iProcessIDinList].FreeF( sFreeLine, sTime );
   508 
   421 						*/
   509 						// Add alloc fragment
   422 
   510 
       
   511 						// first string is for 'free' (address), lets remove it first
       
   512 						GetStringUntilNextSpace( sRestOfLine, true );
       
   513 						//add 'alloc' line
   423 						//add 'alloc' line
   514 						vProcessList[iProcessIDinList].AllocF( sRestOfLine, sTime );
   424 						vProcessList[iProcessIDinList].AllocF( sAllocLine, sTime );
   515 					}
   425 					}
   516 					viSubTestIter++;
   426 					viSubTestIter++;
   517 				}
   427 				}
   518 			}
   428 			}
   519 			// Command free
   429 			// Free header
   520 			else if( ! _stricmp( pCommand, FREE_ID ) )
   430 			else if( ! _stricmp( pCommand, FREEH_ID ) )
   521 			{
   431 			{
   522 				// Send free
   432 				// Send free
   523 				vProcessList[iProcessIDinList].Free( sRestOfLine );
   433 				vProcessList[iProcessIDinList].FreeH( sRestOfLine, sTime );
   524 
   434 
   525 				// Subtests running?
   435 				// Subtests running?
   526 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   436 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
   527 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
   437 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
   528 				{
   438 				{
   529 					if( viSubTestIter->bRunning )
   439 					if( viSubTestIter->bRunning )
   530 					{
   440 					{
   531 						// Send free to subtest
   441 						// Send free to subtest
   532 						viSubTestIter->Free( sRestOfLine );
   442 						viSubTestIter->FreeH( sRestOfLine, sTime );
   533 					}
   443 					}
   534 					viSubTestIter++;
   444 					viSubTestIter++;
   535 				}
   445 				}
   536 			}
       
   537 			// Header free.
       
   538 			else if( ! _stricmp( pCommand, FREEH_ID ) )
       
   539 			{
       
   540 				if( bCreateCleanedTraces )
       
   541 				{
       
   542 				// add message to cleaned traces file
       
   543 				cleanedTraces << sTime << " "; //add time
       
   544 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   545 				cleanedTraces << sProcessID << " "; //add process ID
       
   546 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   547 				}
       
   548 
       
   549 				// Send free
       
   550 				vProcessList[iProcessIDinList].FreeH( sRestOfLine, sTime );
       
   551 
       
   552 				// Subtests running?
       
   553 				vector<CSubTestData>::iterator viSubTestIter = vProcessList[iProcessIDinList].vSubTests.begin();
       
   554 				while( viSubTestIter != vProcessList[iProcessIDinList].vSubTests.end() )
       
   555 				{
       
   556 					if( viSubTestIter->bRunning )
       
   557 					{
       
   558 						// Send free to subtest
       
   559 						viSubTestIter->FreeH( sRestOfLine, sTime );
       
   560 					}
       
   561 					viSubTestIter++;
       
   562 				}
       
   563 			
   446 			
   564 			}
   447 			}
       
   448 			// Free fragment
   565 			else if( ! _stricmp( pCommand, FREEF_ID ) )
   449 			else if( ! _stricmp( pCommand, FREEF_ID ) )
   566 			{
   450 			{
   567 				if( bCreateCleanedTraces )
       
   568 				{
       
   569 				// add message to cleaned traces file
       
   570 				cleanedTraces << sTime << " "; //add time
       
   571 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   572 				cleanedTraces << sProcessID << " "; //add process ID
       
   573 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   574 				}
       
   575 				// Not used currently.
   451 				// Not used currently.
   576 			}
   452 			}
   577 			// Command process end
   453 			// Command process end
   578 			else if( ! _stricmp( pCommand, LABEL_PROCESS_END ) )
   454 			else if( ! _stricmp( pCommand, LABEL_PROCESS_END ) )
   579 			{
   455 			{
   580 				// append processID and time
   456 				// add processID and time
   581 				sWholeTempLine.append(" ");
   457 				sWholeTempLine.append(" ");
   582 				sWholeTempLine.append( sProcessID );
   458 				sWholeTempLine.append( sProcessID );
   583 				sWholeTempLine.append(" ");
   459 				sWholeTempLine.append(" ");
   584 				sWholeTempLine.append( sTime );
   460 				sWholeTempLine.append( sTime );
   585 
       
   586 				if( bCreateCleanedTraces )
       
   587 				{
       
   588 				// add message to cleaned traces file
       
   589 				cleanedTraces << sTime << " "; //add time
       
   590 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   591 				cleanedTraces << sProcessID << " "; //add process ID
       
   592 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   593 				}
       
   594 
   461 
   595 				// Set process has ended.
   462 				// Set process has ended.
   596 				vProcessList[iProcessIDinList].bProcessOnGoing = false;
   463 				vProcessList[iProcessIDinList].bProcessOnGoing = false;
   597 
   464 
   598 				// Save leaks
   465 				// Save leaks
   668 
   535 
   669 				// Clear sub tests from list
   536 				// Clear sub tests from list
   670 				vProcessList[iProcessIDinList].vSubTests.clear();
   537 				vProcessList[iProcessIDinList].vSubTests.clear();
   671 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
   538 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
   672 			}
   539 			}
       
   540 			// Handle leak
   673 			else if( ! _stricmp( pCommand, LABEL_HANDLE_LEAK ) )
   541 			else if( ! _stricmp( pCommand, LABEL_HANDLE_LEAK ) )
   674 			{
   542 			{
   675 				if( bCreateCleanedTraces )
       
   676 				{
       
   677 				// add message to cleaned traces file
       
   678 				cleanedTraces << sTime << " "; //add time
       
   679 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   680 				cleanedTraces << sProcessID << " "; //add process ID
       
   681 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   682 				}
       
   683 
       
   684 				// Make whole line
   543 				// Make whole line
   685 				sTemp.append( " " );
   544 				sTemp.append( " " );
   686 				sTemp.append( sRestOfLine );
   545 				sTemp.append( sRestOfLine );
   687 				vProcessList[iProcessIDinList].vHandleLeaks.push_back( sTemp );
   546 				vProcessList[iProcessIDinList].vHandleLeaks.push_back( sTemp );
   688 			}
   547 			}
       
   548 			// Dll load
   689 			else if( ! _stricmp( pCommand, LABEL_DLL_LOAD ) )
   549 			else if( ! _stricmp( pCommand, LABEL_DLL_LOAD ) )
   690 			{
   550 			{
   691 				if( bCreateCleanedTraces )
   551 				// add time
   692 				{
       
   693 				// add message to cleaned traces file
       
   694 				cleanedTraces << sTime << " "; //add time
       
   695 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   696 				cleanedTraces << sProcessID << " "; //add process ID
       
   697 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   698 				}
       
   699 
       
   700 				// append time to the end of the line
       
   701 				sWholeTempLine.append( " " );
   552 				sWholeTempLine.append( " " );
   702 				sWholeTempLine.append( sTime );
   553 				sWholeTempLine.append( sTime );
   703 
   554 
   704 				// Add module load to process data.
   555 				// Add module load to process data.
   705 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
   556 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
   710 					if( it->bRunning )
   561 					if( it->bRunning )
   711 						it->vData.push_back( sWholeTempLine );
   562 						it->vData.push_back( sWholeTempLine );
   712 				}
   563 				}
   713 
   564 
   714 			}
   565 			}
       
   566 			// Dll unload
   715 			else if( ! _stricmp( pCommand, LABEL_DLL_UNLOAD ) )
   567 			else if( ! _stricmp( pCommand, LABEL_DLL_UNLOAD ) )
   716 			{
   568 			{
   717 				if( bCreateCleanedTraces )
   569 				// add time
   718 				{
       
   719 				// add message to cleaned traces file
       
   720 				cleanedTraces << sTime << " "; //add time
       
   721 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   722 				cleanedTraces << sProcessID << " "; //add process ID
       
   723 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   724 				}
       
   725 
       
   726 				// append time to the end of the line
       
   727 				sWholeTempLine.append( " " );
   570 				sWholeTempLine.append( " " );
   728 				sWholeTempLine.append( sTime );
   571 				sWholeTempLine.append( sTime );
   729 
   572 
   730 				// Add module load to process data.
   573 				// Add module load to process data.
   731 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
   574 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
   739 			}
   582 			}
   740 			else if( sTemp.find( LABEL_LOGGING_CANCELLED ) != string::npos ||
   583 			else if( sTemp.find( LABEL_LOGGING_CANCELLED ) != string::npos ||
   741 				     sTemp.find( LABEL_PROCESS_END ) != string::npos || sTemp.find( LABEL_ERROR_OCCURED ) != string::npos ||
   584 				     sTemp.find( LABEL_PROCESS_END ) != string::npos || sTemp.find( LABEL_ERROR_OCCURED ) != string::npos ||
   742 					 sTemp.find( LABEL_HANDLE_LEAK ) != string::npos )
   585 					 sTemp.find( LABEL_HANDLE_LEAK ) != string::npos )
   743 			{
   586 			{
   744 				if( bCreateCleanedTraces )
       
   745 				{
       
   746 				// add message to cleaned traces file
       
   747 				cleanedTraces << sTime << " "; //add time
       
   748 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   749 				cleanedTraces << sProcessID << " "; //add process ID
       
   750 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   751 				}
       
   752 
       
   753 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
   587 				vProcessList[iProcessIDinList].vData.push_back( sWholeTempLine );
   754 			}
   588 			}
       
   589 			// Subtest start
   755 			else if( ! _stricmp( pCommand, LABEL_TEST_START ) )
   590 			else if( ! _stricmp( pCommand, LABEL_TEST_START ) )
   756 			{
   591 			{
   757 				if( bCreateCleanedTraces )
       
   758 				{
       
   759 				// add message to cleaned traces file
       
   760 				cleanedTraces << sTime << " "; //add time
       
   761 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   762 				cleanedTraces << sProcessID << " "; //add process ID
       
   763 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   764 				}
       
   765 
       
   766 				bRet = true; // Set return value true we found start.
   592 				bRet = true; // Set return value true we found start.
   767 				// Get sub test time
   593 				// Get sub test time
   768 				string sSubTestTime = GetStringUntilNextSpace( sRestOfLine );
   594 				string sSubTestTime = GetStringUntilNextSpace( sRestOfLine );
   769 				// Get sub test name
   595 				// Get sub test name
   770 				string sSubTestName = GetStringUntilNextSpace( sRestOfLine );
   596 				string sSubTestName = GetStringUntilNextSpace( sRestOfLine );
   777 				SubTestData.sSubTestName = sSubTestName;
   603 				SubTestData.sSubTestName = sSubTestName;
   778 				SubTestData.sSubTestStartHandleCount = sSubTestStartHandleCount.c_str();
   604 				SubTestData.sSubTestStartHandleCount = sSubTestStartHandleCount.c_str();
   779 
   605 
   780 				vProcessList[iProcessIDinList].vSubTests.push_back( SubTestData );
   606 				vProcessList[iProcessIDinList].vSubTests.push_back( SubTestData );
   781 			}
   607 			}
       
   608 			// Subtest end
   782 			else if( ! _stricmp( pCommand, LABEL_TEST_END ) )
   609 			else if( ! _stricmp( pCommand, LABEL_TEST_END ) )
   783 			{
   610 			{
   784 				if( bCreateCleanedTraces )
       
   785 				{
       
   786 				// add message to cleaned traces file
       
   787 				cleanedTraces << sTime << " "; //add time
       
   788 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   789 				cleanedTraces << sProcessID << " "; //add process ID
       
   790 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   791 				}
       
   792 
       
   793 				// Get sub test time
   611 				// Get sub test time
   794 				string sSubTestEnd = GetStringUntilNextSpace( sRestOfLine );
   612 				string sSubTestEnd = GetStringUntilNextSpace( sRestOfLine );
   795 				// Get sub test name
   613 				// Get sub test name
   796 				string sSubTestName = GetStringUntilNextSpace( sRestOfLine );
   614 				string sSubTestName = GetStringUntilNextSpace( sRestOfLine );
   797 				// Get sub test end handle count
   615 				// Get sub test end handle count
   808 						viSubTestIter->sSubTestEndHandleCount = sSubTestEndHandleCount.c_str();
   626 						viSubTestIter->sSubTestEndHandleCount = sSubTestEndHandleCount.c_str();
   809 					}
   627 					}
   810 					viSubTestIter++;
   628 					viSubTestIter++;
   811 				}
   629 				}
   812 			}
   630 			}
       
   631 			// Thread start
   813 			else if( ! _stricmp( pCommand, LABEL_THREAD_START ) )
   632 			else if( ! _stricmp( pCommand, LABEL_THREAD_START ) )
   814 			{
   633 			{
   815 				if( bCreateCleanedTraces )
       
   816 				{
       
   817 				// add message to cleaned traces file
       
   818 				cleanedTraces << sTime << " "; //add time
       
   819 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   820 				cleanedTraces << sProcessID << " "; //add process ID
       
   821 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   822 				}
       
   823 
       
   824 				//currently not used
   634 				//currently not used
   825 			}
   635 			}
       
   636 			// Thread end
   826 			else if( ! _stricmp( pCommand, LABEL_THREAD_END ) )
   637 			else if( ! _stricmp( pCommand, LABEL_THREAD_END ) )
   827 			{
   638 			{
   828 				if( bCreateCleanedTraces )
       
   829 				{
       
   830 				// add message to cleaned traces file
       
   831 				cleanedTraces << sTime << " "; //add time
       
   832 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   833 				cleanedTraces << sProcessID << " "; //add process ID
       
   834 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   835 				}
       
   836 
       
   837 				//currently not used
   639 				//currently not used
   838 			}
   640 			}
   839 			else
   641 			else
   840 			{
   642 			{
   841 				// unknown tag, log it to cleaned file for carbide
   643 				// unknown tag, only logged it to cleaned file for carbide
   842 				if( bCreateCleanedTraces )
       
   843 				{
       
   844 				// add message to cleaned traces file
       
   845 				cleanedTraces << sTime << " "; //add time
       
   846 				cleanedTraces << MAIN_ID << " "; //add MAIN_ID
       
   847 				cleanedTraces << sProcessID << " "; //add process ID
       
   848 				cleanedTraces << sWholeTempLine << "\n"; //add the rest of the line
       
   849 				}
       
   850 			}
   644 			}
   851 		}
   645 		}
   852 	}
   646 	}
   853 
   647 
   854 	if( bCreateCleanedTraces )
   648 	if( bCreateCleanedTraces )