add some debug logs to print how long it takes to capture the screen, process the blocks,

send the blocks to the server, and how long it takes for the server to receive all the blocks.
This commit is contained in:
Richard Alam 2012-05-09 10:59:03 -07:00
parent 0fda31fb1d
commit ba16c09a02
7 changed files with 22 additions and 13 deletions

View File

@ -25,9 +25,11 @@ import java.io.ByteArrayOutputStream
import java.util.concurrent.ConcurrentHashMap
import org.bigbluebutton.deskshare.common.ScreenVideoEncoder
import org.bigbluebutton.deskshare.server.session.ScreenVideoFrame
import net.lag.logging.Logger
class BlockManager(room: String, screenDim: Dimension, blockDim: Dimension, waitForAllBlocks: Boolean) extends BlockFactory {
private val log = Logger.get
private var blocksMap = new ConcurrentHashMap[Integer, Block]
private var numberOfRows = getNumberOfRows(screenDim, blockDim)
@ -35,8 +37,10 @@ class BlockManager(room: String, screenDim: Dimension, blockDim: Dimension, wait
private var lastFrameTime = 0L
private var lastKeyFrameTime = 0L
private val KEYFRAME_INTERVAL = 20000
private var blockToUpdate = 1;
private var blockToUpdate = 1
private var startTime = 0L
private var gotAllBlocksTime = 0L
private var gotAllBlocks = false;
def initialize(): Unit = {
println("Initialize BlockManager")
@ -52,6 +56,8 @@ class BlockManager(room: String, screenDim: Dimension, blockDim: Dimension, wait
// block.update(encodedPixels, true, 0)
blocksMap.put(position, block)
}
startTime = System.currentTimeMillis()
}
def updateBlock(position: Int, videoData: Array[Byte], keyFrame: Boolean, seqNum: Int): Unit = {
@ -66,6 +72,8 @@ class BlockManager(room: String, screenDim: Dimension, blockDim: Dimension, wait
return false;
}
}
gotAllBlocksTime = System.currentTimeMillis()
log.info("Received all blocks in " + (gotAllBlocksTime - startTime) + " ms.")
return true;
}
@ -79,7 +87,9 @@ class BlockManager(room: String, screenDim: Dimension, blockDim: Dimension, wait
screenVideoFrame.write(videoDataHeader)
screenVideoFrame.write(encodedDim)
val gotAllBlocks = allBlocksReceived(numberOfBlocks)
if (! gotAllBlocks ) {
gotAllBlocks = allBlocksReceived(numberOfBlocks)
}
for (position: Int <- 1 to numberOfBlocks) {
var block: Block = blocksMap.get(position)

View File

@ -1,4 +1,3 @@
package com.myjavatools.web;
import java.net.URLConnection;

View File

@ -43,11 +43,11 @@ public class ScreenCaptureTaker {
}
private void captureScreen() {
// System.out.println("----- Taking screen capture -----");
System.out.println("----- Taking screen capture -----");
long start = System.currentTimeMillis();
BufferedImage image = capture.takeSingleSnapshot();
long end = System.currentTimeMillis();
// System.out.println("Capture took " + (end - start) + " millis");
System.out.println("Capture took " + (end - start) + " millis");
notifyListeners(image);
}

View File

@ -94,6 +94,8 @@ public class BlockManager {
}
}
long end = System.currentTimeMillis();
System.out.println("Processing blocks took " + (end - start) + " millis");
}
private void notifyChangedBlockListener(BlockMessage position) {

View File

@ -22,7 +22,6 @@ package org.bigbluebutton.deskshare.client.net;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
@ -30,9 +29,7 @@ import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
import org.bigbluebutton.deskshare.common.CaptureEvents;
import com.myjavatools.web.ClientHttpRequest;
public class HttpScreenCaptureSender implements ScreenCaptureSender {

View File

@ -165,7 +165,8 @@ public class NetworkHttpStreamSender implements Runnable {
}
private void processNextMessageToSend(Message message) {
if (message.getMessageType() == Message.MessageType.BLOCK) {
if (message.getMessageType() == Message.MessageType.BLOCK) {
long start = System.currentTimeMillis();
Integer[] changedBlocks = ((BlockMessage)message).getBlocks();
for (int i = 0; i < changedBlocks.length; i++) {
EncodedBlockData block = retriever.getBlockToSend((Integer)changedBlocks[i]);
@ -175,6 +176,8 @@ public class NetworkHttpStreamSender implements Runnable {
for (int i = 0; i< changedBlocks.length; i++) {
retriever.blockSent((Integer)changedBlocks[i]);
}
long end = System.currentTimeMillis();
System.out.println("[HTTP tunnel] Sending " + changedBlocks.length + " blocks took " + (end - start) + " millis");
} else if (message.getMessageType() == Message.MessageType.CURSOR) {
CursorMessage msg = (CursorMessage)message;
sendCursor(msg.getMouseLocation(), msg.getRoom());

View File

@ -19,11 +19,9 @@
**/
package org.bigbluebutton.deskshare.client.net;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.ExecutorService;