ndt-dev - [ndt-dev] [ndt] r1082 committed - S2C (download test) Performance Fix...
Subject: NDT-DEV email list created
List archive
- From:
- To:
- Subject: [ndt-dev] [ndt] r1082 committed - S2C (download test) Performance Fix...
- Date: Tue, 17 Jun 2014 20:38:10 +0000
Revision: 1082
Author:
Date: Tue Jun 17 20:37:53 2014 UTC
Log: S2C (download test) Performance Fix
By not attempting to read ANY data from the
socket until the end of the test (and even
then we don't actually read it), the test
performs like we expect.
http://code.google.com/p/ndt/source/detail?r=1082
Modified:
/branches/Issue144Staging/flash-client/src/TestS2C.as
=======================================
--- /branches/Issue144Staging/flash-client/src/TestS2C.as Mon Jun 16 18:52:53 2014 UTC
+++ /branches/Issue144Staging/flash-client/src/TestS2C.as Tue Jun 17 20:37:53 2014 UTC
@@ -211,7 +211,6 @@
_s2cSocket.addEventListener(IOErrorEvent.IO_ERROR, onS2CError);
_s2cSocket.addEventListener(SecurityErrorEvent.SECURITY_ERROR,
onS2CSecError);
- _s2cSocket.addEventListener(ProgressEvent.SOCKET_DATA, onS2CReceivedData);
}
private function removeS2CSocketEventListeners():void {
@@ -220,8 +219,6 @@
_s2cSocket.removeEventListener(IOErrorEvent.IO_ERROR, onS2CError);
_s2cSocket.removeEventListener(SecurityErrorEvent.SECURITY_ERROR,
onS2CSecError);
- _s2cSocket.removeEventListener(ProgressEvent.SOCKET_DATA,
- onS2CReceivedData);
}
private function onS2CConnect(e:Event):void {
@@ -246,15 +243,9 @@
closeS2CSocket();
endTest();
}
-
- private function onS2CReceivedData(e:ProgressEvent):void {
- _readTimer.stop();
- _readTimer.reset();
- _readTimer.start();
- receiveData();
- }
private function onSpeedUpdate(e:TimerEvent):void {
+ _s2cByteCount = _s2cSocket.bytesAvailable;
_s2cTestDuration = getTimer() - _s2cTestStartTime;
TestResults.ndt_test_results::s2cSpeed = _s2cByteCount
* NDTConstants.BYTES2BITS
@@ -302,27 +293,12 @@
_testStage = RECEIVE_DATA;
TestResults.appendDebugMsg("S2C test: RECEIVE_DATA stage.");
- if (_s2cSocket.bytesAvailable > 0)
- receiveData();
}
private function onS2CTimeout(e:TimerEvent):void {
TestResults.appendDebugMsg("Timeout for receiving data on S2C socket.");
closeS2CSocket();
}
-
- /**
- * Function that is called repeatedly by the S2C socket response listener
- * for the duration of the test. It processes and keeps track of the total
- * bytes received from the server. The test only goes past this stage if:
- * 1. All data was successfully received and the server closed the socket.
- * 2. A read timeout occured on S2C socket.
- * 3. More than NDTConstants.S2C_DURATION seconds have passed since the
- * beginning of the test.
- */
- private function receiveData():void {
- _s2cByteCount += NDTUtils.readAllBytesAndDiscard(_s2cSocket);
- }
private function closeS2CSocket():void {
// Record end time right after it stops receiving data, to be as accurate
@@ -337,8 +313,7 @@
_readTimer.removeEventListener(TimerEvent.TIMER, onS2CTimeout);
_s2cTimer.removeEventListener(TimerEvent.TIMER, onS2CTimeout);
- if (_s2cSocket.connected)
- _s2cByteCount += _s2cSocket.bytesAvailable;
+ _s2cByteCount = _s2cSocket.bytesAvailable;
removeCtlSocketOnReceivedDataListener();
try {
- [ndt-dev] [ndt] r1082 committed - S2C (download test) Performance Fix..., ndt, 06/17/2014
Archive powered by MHonArc 2.6.16.