Changeset 20378 in vbox
- Timestamp:
- Jun 8, 2009 4:50:33 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/Network/slirp/socket.c
r20297 r20378 13 13 #include <sys/filio.h> 14 14 #endif 15 #include <VBox/pdmdrv.h> 15 16 #if defined (RT_OS_WINDOWS) 16 17 #include <iphlpapi.h> … … 123 124 struct iovec iov[2]; 124 125 int mss = so->so_tcpcb->t_maxseg; 126 127 SLIRP_PROFILE_START(IOread, a); 128 SLIRP_COUNTER_RESET(IORead_in_1); 129 SLIRP_COUNTER_RESET(IORead_in_2); 130 125 131 QSOCKET_LOCK(tcb); 126 132 SOCKET_LOCK(so); … … 214 220 { 215 221 SOCKET_UNLOCK(so); 222 SLIRP_PROFILE_STOP(IOread, a); 216 223 return 0; 217 224 } … … 220 227 { 221 228 SOCKET_UNLOCK(so); 229 STAM_PROFILE_STOP(&pData->StatIOread, a); 222 230 return 0; 223 231 } … … 230 238 tcp_sockclosed(pData, sototcpcb(so)); 231 239 SOCKET_UNLOCK(so); 240 STAM_PROFILE_STOP(&pData->StatIOread, a); 232 241 return -1; 233 242 } 234 243 } 244 STAM_STATS( 245 if (n == 1) 246 { 247 STAM_COUNTER_INC(&pData->StatIORead_in_1); 248 STAM_COUNTER_ADD(&pData->StatIORead_in_1_bytes, nn); 249 } 250 else 251 { 252 STAM_COUNTER_INC(&pData->StatIORead_in_2); 253 STAM_COUNTER_ADD(&pData->StatIORead_in_2_1st_bytes, nn); 254 } 255 ); 235 256 236 257 #ifndef HAVE_READV … … 250 271 if (ret > 0) 251 272 nn += ret; 273 STAM_STATS( 274 if(ret > 0) 275 { 276 SLIRP_COUNTER_INC(IORead_in_2); 277 SLIRP_COUNTER_ADD(IORead_in_2_2nd_bytes, ret); 278 } 279 ); 252 280 } 253 281 … … 260 288 if (sb->sb_wptr >= (sb->sb_data + sb->sb_datalen)) 261 289 sb->sb_wptr -= sb->sb_datalen; 290 STAM_PROFILE_STOP(&pData->StatIOread, a); 262 291 SOCKET_UNLOCK(so); 263 292 return nn; … … 372 401 struct iovec iov[2]; 373 402 403 SLIRP_PROFILE_START(IOwrite, a); 404 SLIRP_COUNTER_RESET(IOWrite_in_1); 405 SLIRP_COUNTER_RESET(IOWrite_in_1_bytes); 406 SLIRP_COUNTER_RESET(IOWrite_in_2); 407 SLIRP_COUNTER_RESET(IOWrite_in_2_1st_bytes); 408 SLIRP_COUNTER_RESET(IOWrite_in_2_2nd_bytes); 409 SLIRP_COUNTER_RESET(IOWrite_no_w); 410 SLIRP_COUNTER_RESET(IOWrite_rest); 411 SLIRP_COUNTER_RESET(IOWrite_rest_bytes); 374 412 DEBUG_CALL("sowrite"); 375 413 DEBUG_ARG("so = %lx", (long)so); … … 383 421 { 384 422 SOCKET_UNLOCK(so); 423 STAM_PROFILE_STOP(&pData->StatIOwrite, a); 385 424 return 0; 386 425 } … … 422 461 n = 1; 423 462 } 463 STAM_STATS({ 464 if (n == 1) 465 { 466 SLIRP_COUNTER_INC(IOWrite_in_1); 467 SLIRP_COUNTER_ADD(IOWrite_in_1_bytes, iov[0].iov_len); 468 } 469 else 470 { 471 SLIRP_COUNTER_INC(IOWrite_in_2); 472 SLIRP_COUNTER_ADD(IOWrite_in_2_1st_bytes, iov[0].iov_len); 473 SLIRP_COUNTER_ADD(IOWrite_in_2_2nd_bytes, iov[1].iov_len); 474 } 475 }); 424 476 /* Check if there's urgent data to send, and if so, send it */ 425 477 #ifdef HAVE_READV … … 433 485 { 434 486 SOCKET_UNLOCK(so); 487 STAM_PROFILE_STOP(&pData->StatIOwrite, a); 435 488 return 0; 436 489 } … … 443 496 tcp_sockclosed(pData, sototcpcb(so)); 444 497 SOCKET_UNLOCK(so); 498 STAM_PROFILE_STOP(&pData->StatIOwrite, a); 445 499 return -1; 446 500 } … … 453 507 if (ret > 0) 454 508 nn += ret; 509 STAM_STATS({ 510 if (ret > 0 && ret != iov[1].iov_len) 511 { 512 SLIRP_COUNTER_INC(IOWrite_rest); 513 SLIRP_COUNTER_ADD(IOWrite_rest_bytes, (ret - iov[1].iov_len)); 514 } 515 }); 455 516 } 456 517 DEBUG_MISC((dfd, " ... wrote nn = %d bytes\n", nn)); … … 471 532 472 533 SOCKET_UNLOCK(so); 534 SLIRP_PROFILE_STOP(IOwrite, a); 473 535 return nn; 474 536 }
Note:
See TracChangeset
for help on using the changeset viewer.