agent/browser/ie/pagetest/PagetestReporting.cpp
/*-----------------------------------------------------------------------------
	Generate the detailled report for a single request
-----------------------------------------------------------------------------*/
Generate the detailled report for a single request
Generate the detailled report for a single request
void CPagetestReporting::ReportRequest(CString & szReport, CWinInetRequest * r)
{
	szReport.Empty();
	if( r )
	{
		CString szBuff;
		szBuff.Format(_T("      Action: %s\n"), (LPCTSTR)r->verb );
		szReport += szBuff;
		szBuff.Format(_T("      Url: %s\n"), (LPCTSTR)(r->scheme + CString(_T("//")) + r->host + r->object) );
		szReport += szBuff;
		szBuff.Format(_T("      Host: %s\n"), (LPCTSTR)r->host );
		szReport += szBuff;
		szBuff.Format(_T("      Result code: %d\n"), r->result );
		szReport += szBuff;
		szBuff.Format(_T("      Transaction time: %0.3f seconds\n"), r->elapsed );
		szReport += szBuff;
		szBuff.Format(_T("      Time to first byte: %0.3f seconds\n"), (double)r->tmRequest / 1000.0 );
		szReport += szBuff;
		szBuff.Format(_T("      Document: %d\n"), r->docID );
		szReport += szBuff;
		szBuff.Format(_T("      Socket: %d\n"), r->socketId );
		szReport += szBuff;
		szBuff.Format(_T("      Request size (out): %d Bytes\n"), r->out );
		szReport += szBuff;
		szBuff.Format(_T("      Response size (in): %d Bytes\n"), r->in );
		szReport += szBuff;
		szBuff.Format(_T("      Request Object Size (out): %d Bytes\n"), r->out - r->outHeaders.GetLength() );
		szReport += szBuff;
		szBuff.Format(_T("      Response Object Size (in): %d Bytes\n"), r->in - r->inHeaders.GetLength() );
		szReport += szBuff;
		szBuff.Format(_T("      Response Object Size (bodylen): %d Bytes\n"), r->bodyLen );
		szReport += szBuff;
		szReport +=   _T("  Request Headers:\n");
		int pos = 0;
		while( pos >= 0 )
		{
			CString line = r->outHeaders.Tokenize(_T("\r\n"), pos);
			line.Trim();
			if( line.GetLength() )
				szReport += CString(_T("      ")) + line + _T("\n");
		}
		szReport += _T("  Response Headers:\n");
		pos = 0;
		while( pos >= 0 )
		{
			CString line = r->inHeaders.Tokenize(_T("\r\n"), pos);
			line.Trim();
			if( line.GetLength() )
				szReport += CString(_T("      ")) + line + _T("\n");
		}
		if ( !r->cachedInHeaders.IsEmpty() ) 
		{
			szReport += _T("  Cached Response Headers:\n");
			pos = 0;
			while( pos >= 0 )
			{
				CString line = r->cachedInHeaders.Tokenize(_T("\r\n"), pos);
				line.Trim();
				if( line.GetLength() )
					szReport += CString(_T("      ")) + line + _T("\n");
			}
		}
	}
}
void CPagetestReporting :: ReportRequest ( CString & szReport , CWinInetRequest * r ) { szReport . Empty ( ) ; if ( r ) { CString szBuff ; szBuff . Format ( _T ( " \n " ) , ( LPCTSTR ) r -> verb ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , ( LPCTSTR ) ( r -> scheme + CString ( _T ( " " ) ) + r -> host + r -> object ) ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , ( LPCTSTR ) r -> host ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> result ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> elapsed ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , ( double ) r -> tmRequest / 1000.0 ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> docID ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> socketId ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> out ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> in ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> out - r -> outHeaders . GetLength ( ) ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> in - r -> inHeaders . GetLength ( ) ) ; szReport += szBuff ; szBuff . Format ( _T ( " \n " ) , r -> bodyLen ) ; szReport += szBuff ; szReport += _T ( " \n " ) ; int pos = 0 ; while ( pos >= 0 ) { CString line = r -> outHeaders . Tokenize ( _T ( " \r \n " ) , pos ) ; line . Trim ( ) ; if ( line . GetLength ( ) ) szReport += CString ( _T ( " " ) ) + line + _T ( " \n " ) ; } szReport += _T ( " \n " ) ; pos = 0 ; while ( pos >= 0 ) { CString line = r -> inHeaders . Tokenize ( _T ( " \r \n " ) , pos ) ; line . Trim ( ) ; if ( line . GetLength ( ) ) szReport += CString ( _T ( " " ) ) + line + _T ( " \n " ) ; } if ( ! r -> cachedInHeaders . IsEmpty ( ) ) { szReport += _T ( " \n " ) ; pos = 0 ; while ( pos >= 0 ) { CString line = r -> cachedInHeaders . Tokenize ( _T ( " \r \n " ) , pos ) ; line . Trim ( ) ; if ( line . GetLength ( ) ) szReport += CString ( _T ( " " ) ) + line + _T ( " \n " ) ; } } } }
Generate the detailled report for a single request
Generate the detailled report for a single request