add more voxel edit transit time debugging

This commit is contained in:
ZappoMan 2013-11-08 10:47:47 -08:00
parent a9c5c0707f
commit 2e8cb63abb
2 changed files with 33 additions and 14 deletions

View file

@ -608,6 +608,34 @@ void VoxelServer::run() {
|| packetData[0] == PACKET_TYPE_SET_VOXEL_DESTRUCTIVE
|| packetData[0] == PACKET_TYPE_ERASE_VOXEL
|| packetData[0] == PACKET_TYPE_Z_COMMAND)) {
const char* messageName;
switch (packetData[0]) {
case PACKET_TYPE_SET_VOXEL:
messageName = "PACKET_TYPE_SET_VOXEL";
break;
case PACKET_TYPE_SET_VOXEL_DESTRUCTIVE:
messageName = "PACKET_TYPE_SET_VOXEL_DESTRUCTIVE";
break;
case PACKET_TYPE_ERASE_VOXEL:
messageName = "PACKET_TYPE_ERASE_VOXEL";
break;
}
int numBytesPacketHeader = numBytesForPacketHeader(packetData);
if (packetData[0] != PACKET_TYPE_Z_COMMAND) {
unsigned short int sequence = (*((unsigned short int*)(packetData + numBytesPacketHeader)));
uint64_t sentAt = (*((uint64_t*)(packetData + numBytesPacketHeader + sizeof(sequence))));
uint64_t arrivedAt = usecTimestampNow();
uint64_t transitTime = arrivedAt - sentAt;
if (wantShowAnimationDebug() || wantsDebugVoxelReceiving()) {
printf("RECEIVE THREAD: got %s - command from client receivedBytes=%ld sequence=%d transitTime=%llu usecs\n",
messageName,
packetLength, sequence, transitTime);
}
}
_voxelServerPacketProcessor->queueReceivedPacket(senderAddress, packetData, packetLength);
} else {
// let processNodeData handle it.

View file

@ -44,14 +44,9 @@ void VoxelServerPacketProcessor::processPacket(sockaddr& senderAddress, unsigned
uint64_t sentAt = (*((uint64_t*)(packetData + numBytesPacketHeader + sizeof(sequence))));
uint64_t arrivedAt = usecTimestampNow();
uint64_t transitTime = arrivedAt - sentAt;
if (_myServer->wantShowAnimationDebug()) {
printf("got %s - command from client receivedBytes=%ld sequence=%d transitTime=%llu usecs\n",
destructive ? "PACKET_TYPE_SET_VOXEL_DESTRUCTIVE" : "PACKET_TYPE_SET_VOXEL",
packetLength, sequence, transitTime);
}
if (_myServer->wantsDebugVoxelReceiving()) {
printf("got %s - %d command from client receivedBytes=%ld sequence=%d transitTime=%llu usecs\n",
if (_myServer->wantShowAnimationDebug() || _myServer->wantsDebugVoxelReceiving()) {
printf("PROCESSING THREAD: got %s - %d command from client receivedBytes=%ld sequence=%d transitTime=%llu usecs\n",
destructive ? "PACKET_TYPE_SET_VOXEL_DESTRUCTIVE" : "PACKET_TYPE_SET_VOXEL",
_receivedPacketCount, packetLength, sequence, transitTime);
}
@ -122,13 +117,9 @@ void VoxelServerPacketProcessor::processPacket(sockaddr& senderAddress, unsigned
uint64_t sentAt = (*((uint64_t*)(packetData + numBytesPacketHeader + sizeof(sequence))));
uint64_t arrivedAt = usecTimestampNow();
uint64_t transitTime = arrivedAt - sentAt;
if (_myServer->wantShowAnimationDebug()) {
printf("got PACKET_TYPE_ERASE_VOXEL - command from client receivedBytes=%ld sequence=%d transitTime=%llu usecs\n",
packetLength, sequence, transitTime);
}
if (_myServer->wantsDebugVoxelReceiving()) {
printf("got PACKET_TYPE_ERASE_VOXEL - %d command from client receivedBytes=%ld sequence=%d transitTime=%llu usecs\n",
if (_myServer->wantShowAnimationDebug() || _myServer->wantsDebugVoxelReceiving()) {
printf("PROCESSING THREAD: got PACKET_TYPE_ERASE_VOXEL - %d command from client receivedBytes=%ld sequence=%d transitTime=%llu usecs\n",
_receivedPacketCount, packetLength, sequence, transitTime);
}