bool PageNetTest::netTestStart_r( bool amThread, long num ) { long long endTime = 0; long long calcTime = 0; long count; long index = 0; m_running = true; m_startTime = gettimeofdayInMilliseconds(); endTime = gettimeofdayInMilliseconds(); if( (m_sock[num] = openSock( num, m_type[num], &m_name[num], m_port[num])) == -1 ) return false; while( (endTime - m_startTime) < (m_testDuration * 1000) ) { count = 0; calcTime = gettimeofdayInMilliseconds(); if( m_type[num] == TEST_READ ) count = readSock( m_sock[num] ); else if( m_type[num] == TEST_SEND ) count = sendSock( m_sock[num] ); endTime = gettimeofdayInMilliseconds(); float secs = (endTime - calcTime)/1000.0; float mb = (float)count * 8.0 / (1024.0 * 1024.0); float mbps = mb/secs; log( LOG_INFO, "net: nettest: took %lli ms to %s %li bytes at " "%.2f Mbps", endTime - calcTime, (m_type[num] == TEST_READ)?"receive":"send", count, mbps ); log( LOG_INFO, "net: nettest: run time %lli s", (endTime-m_startTime)/1000 ); m_calcTable[num][index] = (unsigned long)mbps; if( ++index >= AVG_TABLE_SIZE ) index = 0; if( !m_runNetTest ) break; } m_sock[num] = closeSock( m_sock[num] ); return true; }
IeParser::IeParser( unsigned long wsharkIp ) { openSock( wsharkIp ); }