Commit 388dd52
committed
Compute network byte deltas in ProcessGroupStatsMonitor
`_read_network_bytes()` reads cumulative counters from `/proc/net/dev` which include all traffic since the interface was brought up. The `net_rx_bytes` and `net_tx_bytes` fields in `ProcessGroupResourceUsage` were previously set to these raw cumulative values, making it difficult to interpret how much network I/O occurred during each monitoring interval.
This change computes deltas between consecutive snapshots, matching the pattern already used for `cpu_percent`. On the first snapshot, `net_rx_bytes` and `net_tx_bytes` are `None` (no previous value to diff against). The raw cumulative values are threaded through `_collect_pgrp_stats` as internal state so subsequent calls can compute the difference.1 parent 4dbfa40 commit 388dd52
2 files changed
Lines changed: 68 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
440 | | - | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
441 | 445 | | |
442 | 446 | | |
443 | | - | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
444 | 452 | | |
445 | 453 | | |
446 | 454 | | |
447 | 455 | | |
448 | 456 | | |
449 | | - | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
450 | 460 | | |
451 | 461 | | |
452 | 462 | | |
| |||
459 | 469 | | |
460 | 470 | | |
461 | 471 | | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
462 | 476 | | |
463 | 477 | | |
464 | | - | |
| 478 | + | |
| 479 | + | |
465 | 480 | | |
| 481 | + | |
466 | 482 | | |
467 | 483 | | |
468 | 484 | | |
469 | 485 | | |
470 | 486 | | |
471 | 487 | | |
| 488 | + | |
| 489 | + | |
472 | 490 | | |
473 | 491 | | |
474 | 492 | | |
| |||
492 | 510 | | |
493 | 511 | | |
494 | 512 | | |
495 | | - | |
496 | | - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
497 | 518 | | |
498 | 519 | | |
499 | 520 | | |
500 | | - | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
501 | 528 | | |
502 | 529 | | |
503 | 530 | | |
| |||
528 | 555 | | |
529 | 556 | | |
530 | 557 | | |
| 558 | + | |
| 559 | + | |
531 | 560 | | |
532 | 561 | | |
533 | | - | |
534 | | - | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
535 | 575 | | |
536 | 576 | | |
537 | 577 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
77 | 86 | | |
78 | 87 | | |
79 | 88 | | |
| |||
449 | 458 | | |
450 | 459 | | |
451 | 460 | | |
452 | | - | |
| 461 | + | |
453 | 462 | | |
454 | 463 | | |
455 | 464 | | |
| |||
0 commit comments