TEST_F(TestNS, BigDataTest) { int64_t readlocallen, writenlen, writentotal; int64_t buffersize = 10<<20; char *buf = (char *)malloc(buffersize); client_->MakeDirectory("/testdir4"); for (int32_t k = 0; k<7; ++k) { writentotal = 0; string ks = string("/testdir4/file").append(Int32ToString(k)); printf("filepath: %s.\n", ks.c_str()); int64_t fid = client_->Create(ks, 0, 3); ASSERT_GT(fid, 0); int localfid = open("/root/BladeStore/trunk/client/test/sample", O_RDONLY); do{ readlocallen = read(localfid, buf, buffersize); if(readlocallen > 0) { LOGV(LL_INFO, "readlocallen: %ld.", readlocallen); writenlen = client_->Write(fid, buf, readlocallen); ASSERT_EQ(readlocallen, writenlen); } writentotal += writenlen; } while (readlocallen > 0); close(localfid); client_->Close(fid); LOGV(LL_INFO, "WritenLen: %ld.", writentotal); } free(buf); }
void ThroughputModePanel::RefreshResultList(void) { ResultLog *rlog = ResultLog::GetInstance(); Result *result = rlog->GetResults( wxString( wxT("throughput") ) ); m_ListResult->DeleteAllItems(); for( int i = result->GetRowCount()-1 ; i > -1 ; i-- ) { StringValueList *row = result->GetRow( i ); wxListItem item; int id = m_ListResult->GetItemCount(); item.SetMask(wxLIST_MASK_TEXT); item.SetId(id); item.SetData( i ); item.SetText( *row->Item(0)->GetData() ); m_ListResult->InsertItem( item ); int iD_TP_Bandwidth; row->Item(1)->GetData()->ToLong( (long*)&iD_TP_Bandwidth ); wxString D_TP_Bandwidth; if( iD_TP_Bandwidth > 0 ) D_TP_Bandwidth << FROMCSTR(Int32ToString(iD_TP_Bandwidth*8)); else D_TP_Bandwidth << wxT("Inget värde"); m_ListResult->SetItem( id, 1, D_TP_Bandwidth ); int iU_TP_Bandwidth; row->Item(2)->GetData()->ToLong( (long*)&iU_TP_Bandwidth ); wxString U_TP_Bandwidth; if( iU_TP_Bandwidth > 0 ) U_TP_Bandwidth << FROMCSTR(Int32ToString(iU_TP_Bandwidth*8)); else U_TP_Bandwidth << wxT("Inget värde"); m_ListResult->SetItem( id, 2, U_TP_Bandwidth ); int iHTTP_Bandwidth; row->Item(3)->GetData()->ToLong( (long*)&iHTTP_Bandwidth ); wxString HTTP_Bandwidth; if( iHTTP_Bandwidth > 0 ) HTTP_Bandwidth << FROMCSTR(Int32ToString(iHTTP_Bandwidth)); else HTTP_Bandwidth << wxT("Inget värde"); m_ListResult->SetItem( id, 3, HTTP_Bandwidth ); int iFTP_Bandwidth; row->Item(4)->GetData()->ToLong( (long*)&iFTP_Bandwidth ); wxString FTP_Bandwidth; if( iFTP_Bandwidth > 0 ) FTP_Bandwidth << FROMCSTR(Int32ToString(iFTP_Bandwidth)); else FTP_Bandwidth << wxT("Inget värde"); m_ListResult->SetItem( id, 4, FTP_Bandwidth ); } return; }
bool CDStoreCodecPlugin::Link( void* modulePtr , TPluginMetaDataPtr pluginMetaData ) {GUCEF_TRACE; if ( IsLoaded() ) return false; _sohandle = modulePtr; if ( NULL != _sohandle ) { GUCEF_SYSTEM_LOG( LOGLEVEL_NORMAL, "DStoreCodecPlugin: Linking API using module pointer: " + PointerToString( modulePtr ) ); _fptable[ DSTOREPLUG_INIT ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Init" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_SHUTDOWN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Shutdown" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_NAME ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Name" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_COPYRIGHT ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Copyright" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_VERSION ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Version" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_TYPE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Type" , 1*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_DEST_FILE_OPEN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Dest_File_Open" , 3*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_DEST_FILE_CLOSE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Dest_File_Close" , 2*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_BEGIN_NODE_STORE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Begin_Node_Store" , 3*sizeof(void*)+8 ).funcPtr; _fptable[ DSTOREPLUG_END_NODE_STORE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_End_Node_Store" , 3*sizeof(void*)+8 ).funcPtr; _fptable[ DSTOREPLUG_STORE_NODE_ATT ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Store_Node_Att" , 5*sizeof(void*)+12 ).funcPtr; _fptable[ DSTOREPLUG_BEGIN_NODE_CHILDREN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Begin_Node_Children" , 3*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_END_NODE_CHILDREN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_End_Node_Children" , 3*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_SRC_FILE_OPEN ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Src_File_Open" , 2*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_SRC_FILE_CLOSE ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Src_File_Close" , 2*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_SET_READ_HANDLERS ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Set_Read_Handlers" , 4*sizeof(void*) ).funcPtr; _fptable[ DSTOREPLUG_START_READING ] = GetFunctionAddress( _sohandle , "DSTOREPLUG_Start_Reading" , 2*sizeof(void*) ).funcPtr; if ( ( _fptable[ DSTOREPLUG_INIT ] == NULL ) || ( _fptable[ DSTOREPLUG_SHUTDOWN ] == NULL ) || ( _fptable[ DSTOREPLUG_NAME ] == NULL ) || ( _fptable[ DSTOREPLUG_COPYRIGHT ] == NULL ) || ( _fptable[ DSTOREPLUG_VERSION ] == NULL ) || ( _fptable[ DSTOREPLUG_TYPE ] == NULL ) || ( _fptable[ DSTOREPLUG_DEST_FILE_OPEN ] == NULL ) || ( _fptable[ DSTOREPLUG_DEST_FILE_CLOSE ] == NULL ) || ( _fptable[ DSTOREPLUG_BEGIN_NODE_STORE ] == NULL ) || ( _fptable[ DSTOREPLUG_END_NODE_STORE ] == NULL ) || ( _fptable[ DSTOREPLUG_STORE_NODE_ATT ] == NULL ) || ( _fptable[ DSTOREPLUG_BEGIN_NODE_CHILDREN ] == NULL ) || ( _fptable[ DSTOREPLUG_END_NODE_CHILDREN ] == NULL ) || ( _fptable[ DSTOREPLUG_SRC_FILE_OPEN ] == NULL ) || ( _fptable[ DSTOREPLUG_SRC_FILE_CLOSE ] == NULL ) || ( _fptable[ DSTOREPLUG_SET_READ_HANDLERS ] == NULL ) || ( _fptable[ DSTOREPLUG_START_READING ] == NULL ) ) { memset( _fptable, NULL, sizeof(anyPointer) * DSTOREPLUG_LASTFPTR ); _sohandle = NULL; GUCEF_ERROR_LOG( LOGLEVEL_NORMAL, "Invalid codec module: One or more functions could not be located in the module " + PointerToString( modulePtr ) ); return false; } /* * Intialize the plugin module */ UInt32 statusCode = ( (TDSTOREPLUGFPTR_Init) _fptable[ DSTOREPLUG_INIT ] )( &_plugdata ); if ( statusCode > 0 ) { // We have loaded & linked our plugin module GUCEF_SYSTEM_LOG( LOGLEVEL_NORMAL, "DStoreCodecPlugin: Successfully loaded module and invoked Init() which returned status " + Int32ToString( statusCode ) + " using module: " + PointerToString( modulePtr ) ); GUCEF_SYSTEM_LOG( LOGLEVEL_NORMAL, " - Name: " + GetName() ); GUCEF_SYSTEM_LOG( LOGLEVEL_NORMAL, " - Copyright/EULA: " + GetCopyright() ); // Copy the given metadata and update it with info from the actual module m_metaData = new CPluginMetaData( *pluginMetaData ); m_metaData->SetDescription( GetDescription() ); m_metaData->SetCopyright( GetCopyright() ); m_metaData->SetVersion( GetVersion() ); return true; } else { memset( _fptable, NULL, sizeof(anyPointer) * DSTOREPLUG_LASTFPTR ); _sohandle = NULL; _plugdata = NULL; GUCEF_ERROR_LOG( LOGLEVEL_NORMAL, "Initialization routine reported an error for module " + PointerToString( modulePtr ) ); return false; } } return false; }
void ThroughputDetail::RefreshList(int irow) { Result *result = m_rl->GetResults( wxString( wxT("throughput") ) ); StringValueList *row = result->GetRow( irow ); // TPTEST Downstream wxStringTokenizer tkzD_TPVals( *row->Item(5)->GetData(), wxT("|")); while ( tkzD_TPVals.HasMoreTokens() ) { wxString host = tkzD_TPVals.GetNextToken(); wxString bps = tkzD_TPVals.GetNextToken(); // this should not happen if( host.Length() == 0 ) break; wxString strBPS; long lBPS; bps.ToLong( &lBPS ); if( lBPS > 0 ) { wxString str( FROMCSTR(Int32ToString(lBPS*8)) ); strBPS << str; } else { strBPS << wxT("-"); } wxListItem item; int id = m_List->GetItemCount(); item.SetMask(wxLIST_MASK_TEXT); item.SetId(id); item.SetText( wxString( wxT("TPTEST nedströms") ) ); m_List->InsertItem( item ); m_List->SetItem( id, 1, host ); m_List->SetItem( id, 2, strBPS ); } // TPTEST Upstream wxStringTokenizer tkzU_TPVals( *row->Item(6)->GetData(), wxT("|")); while ( tkzU_TPVals.HasMoreTokens() ) { wxString host = tkzU_TPVals.GetNextToken(); wxString bps = tkzU_TPVals.GetNextToken(); // this should not happen if( host.Length() == 0 ) break; wxString strBPS; long lBPS; bps.ToLong( &lBPS ); if( lBPS > 0 ) { wxString str( FROMCSTR(Int32ToString(lBPS*8)) ); strBPS << str; } else { strBPS << wxT("-"); } wxListItem item; int id = m_List->GetItemCount(); item.SetMask(wxLIST_MASK_TEXT); item.SetId(id); item.SetText( wxString( wxT("TPTEST uppströms")) ); m_List->InsertItem( item ); m_List->SetItem( id, 1, host ); m_List->SetItem( id, 2, strBPS ); } // HTTP wxStringTokenizer tkzHTTPVals( *row->Item(7)->GetData(), wxT("|")); while ( tkzHTTPVals.HasMoreTokens() ) { wxString host = tkzHTTPVals.GetNextToken(); wxString bps = tkzHTTPVals.GetNextToken(); // this should not happen if( host.Length() == 0 ) break; wxString strBPS; long lBPS; bps.ToLong( &lBPS ); if( lBPS > 0 ) { wxString str( FROMCSTR(Int32ToString(lBPS)) ); strBPS << str; } else { strBPS << wxT("-"); } wxListItem item; int id = m_List->GetItemCount(); item.SetMask(wxLIST_MASK_TEXT); item.SetId(id); item.SetText( wxString( wxT("HTTP") ) ); m_List->InsertItem( item ); m_List->SetItem( id, 1, host ); m_List->SetItem( id, 2, strBPS ); } // FTP wxStringTokenizer tkzFTPVals( *row->Item(8)->GetData(), wxT("|")); while ( tkzFTPVals.HasMoreTokens() ) { wxString host = tkzFTPVals.GetNextToken(); wxString bps = tkzFTPVals.GetNextToken(); // this should not happen if( host.Length() == 0 ) break; wxString strBPS; long lBPS; bps.ToLong( &lBPS ); if( lBPS > 0 ) { wxString str( FROMCSTR(Int32ToString(lBPS)) ); strBPS << str; } else { strBPS << wxT("-"); } wxListItem item; int id = m_List->GetItemCount(); item.SetMask(wxLIST_MASK_TEXT); item.SetId(id); item.SetText( wxString( wxT("FTP") ) ); m_List->InsertItem( item ); m_List->SetItem( id, 1, host ); m_List->SetItem( id, 2, strBPS ); } }
void ReportDialog::OnTimer( wxTimerEvent& event ) { if( m_dummy > 99 ) m_dummy = 0; TestMarshall *tm = TestMarshall::GetInstance(); wxString title; if( m_step == 0 ) // Init and OS Info { if( NextStep() ) { this->m_Output->AppendText( wxT("\n\n----------------------------\n\n") ); Run(1); } } else if( m_step == 1 ) // TCP window size { if( NextStep() ) { this->m_Output->AppendText( wxT("\n\n----------------------------\n\n") ); Run(2); } } else if( m_step == 2 ) // External IP { title << wxT("Kontrollerar extern IP"); if( NextStep() ) { this->m_Output->AppendText( wxT("\n\n----------------------------\n\n") ); Run(3); } } else if( m_step == 3 ) { title << wxT("Kontrollerar dina n�tverksinst�llningar"); if( NextStep() ) { this->m_Output->AppendText( wxT("\n\n----------------------------\n\n") ); Run(4); return; } if( m_proc_running ) { this->OutputBuffer(); } else { while( this->OutputBuffer() ); } m_stepDone = !m_proc_running; } else if( m_step == 4 ) // netstat { title << wxT("Kontrollerar din nuvarande n�tverkskopplingar"); if( NextStep() ) { this->m_Output->AppendText( wxT("\n\n----------------------------\n\n") ); Run(5); return; } if( m_proc_running ) { this->OutputBuffer(); } else { while( this->OutputBuffer() ); } m_stepDone = !m_proc_running; } else if( m_step == 5 ) // tptest downstream { title << FROMCSTR(tm->GetProgressString()); if( NextStep() ) { this->m_Output->AppendText( wxT("\n\n----------------------------\n\n") ); Run(6); return; } if( tm->GetCompletedStatus() ) { // TCP nedstr�ms TPEngine *engp = tm->GetDownstreamTPEngineStruct(0); wxString Bandwidth( FROMCSTR( Int32ToString( (int)engp->bestTCPRecvRate*8) ) ); m_Output->AppendText( wxT("\n\nTCP nedstr�ms : ") ); m_Output->AppendText( Bandwidth ); m_Output->AppendText( wxT("\n") ); Bandwidth.Clear(); // TCP uppstr�ms engp = tm->GetUpstreamTPEngineStruct(0); Bandwidth << FROMCSTR( Int32ToString( (int)engp->bestTCPSendRate*8) ); m_Output->AppendText( wxT("\nTCP uppstr�ms : ") ); m_Output->AppendText( Bandwidth ); m_Output->AppendText( wxT("\n") ); Bandwidth.Clear(); // UDP nedstr�ms engp = tm->GetDownstreamTPEngineStruct(1); Bandwidth << FROMCSTR( Int32ToString( (int)engp->bestUDPRecvRate*8 ) ); m_Output->AppendText( wxT("\nUDP nedstr�ms : ") ); m_Output->AppendText( Bandwidth ); m_Output->AppendText( wxT("\n") ); Bandwidth.Clear(); // UDP uppstr�ms engp = tm->GetUpstreamTPEngineStruct(1); Bandwidth << FROMCSTR( Int32ToString( (int)engp->bestUDPSendRate*8) ); m_Output->AppendText( wxT("\nUDP uppstr�ms : ") ); m_Output->AppendText( Bandwidth ); m_Output->AppendText( wxT("\n") ); Bandwidth.Clear(); m_stepDone = true; } } else if( m_step == 6 ) { title << wxT("Utf�r traceroute"); if( m_proc_running ) { this->OutputBuffer(); } else { while( this->OutputBuffer() ); } m_stepDone = !m_proc_running; } bool Ok = this->m_dlgProgress->Update( m_dummy++, title ); if( !m_Closed && (m_step == 6 && m_stepDone) || !Ok ) { TestMarshall *tm = TestMarshall::GetInstance(); this->m_Output->AppendText( wxT("\n\n----------- END --------------\n\n") ); this->m_timer->Stop(); if( m_TPTestInitialized ) tm->DeinitTestEngine(!Ok); this->SetCursor( *wxSTANDARD_CURSOR ); this->m_dlgProgress->Show(false); this->m_ButtonSaveToFile->Enable(true); m_Done = true; } }