Home / Class/ TrafficCounter Class — netty Architecture

TrafficCounter Class — netty Architecture

Architecture documentation for the TrafficCounter class in TrafficCounter.java from the netty codebase.

Entity Profile

Dependency Diagram

graph TD
  0606a665_efe6_a36d_b40e_7c957ec61157["TrafficCounter"]
  3aa9a1e0_40e1_b7b2_46b2_7f6fb2adf821["TrafficCounter.java"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|defined in| 3aa9a1e0_40e1_b7b2_46b2_7f6fb2adf821
  3a7ac9a4_071b_42d6_770c_79e68b9cb0a0["milliSecondFromNano()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 3a7ac9a4_071b_42d6_770c_79e68b9cb0a0
  299bb567_42e6_09f5_d6b1_0af3db332d4c["start()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 299bb567_42e6_09f5_d6b1_0af3db332d4c
  5e4871b7_eba5_c41b_7640_6d372497627c["stop()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 5e4871b7_eba5_c41b_7640_6d372497627c
  f0559304_8ba6_0605_464e_6fac6ea4a7a0["resetAccounting()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| f0559304_8ba6_0605_464e_6fac6ea4a7a0
  24356a61_4436_e4e2_1f73_200e10f2fcd5["TrafficCounter()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 24356a61_4436_e4e2_1f73_200e10f2fcd5
  1d050615_bf97_6cfa_8d1d_7dcfe4bf80b9["init()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 1d050615_bf97_6cfa_8d1d_7dcfe4bf80b9
  5248e4b7_37c1_bd3a_13dd_c41b35aadaa3["configure()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 5248e4b7_37c1_bd3a_13dd_c41b35aadaa3
  61cb3f2f_0a19_011f_d877_fb783c44b667["bytesRecvFlowControl()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 61cb3f2f_0a19_011f_d877_fb783c44b667
  a172d9ca_6329_1609_7697_152880492048["bytesWriteFlowControl()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| a172d9ca_6329_1609_7697_152880492048
  7919f81e_3c45_9d44_a2d2_a9943aa8d52a["bytesRealWriteFlowControl()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 7919f81e_3c45_9d44_a2d2_a9943aa8d52a
  bf6c311d_5606_4900_4fb7_37655dfec8f5["checkInterval()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| bf6c311d_5606_4900_4fb7_37655dfec8f5
  9b821b51_059a_3f03_062c_461f118b3d54["lastReadThroughput()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 9b821b51_059a_3f03_062c_461f118b3d54
  8c505a6d_59cb_fe51_b582_a4819bfaaf7e["lastWriteThroughput()"]
  0606a665_efe6_a36d_b40e_7c957ec61157 -->|method| 8c505a6d_59cb_fe51_b582_a4819bfaaf7e

Relationship Graph

Source Code

handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java lines 38–619

public class TrafficCounter {

    private static final InternalLogger logger = InternalLoggerFactory.getInstance(TrafficCounter.class);

    /**
     * @return the time in ms using nanoTime, so not real EPOCH time but elapsed time in ms.
     */
    public static long milliSecondFromNano() {
        return System.nanoTime() / 1000000;
    }

    /**
     * Current written bytes
     */
    private final AtomicLong currentWrittenBytes = new AtomicLong();

    /**
     * Current read bytes
     */
    private final AtomicLong currentReadBytes = new AtomicLong();

    /**
     * Last writing time during current check interval
     */
    private long writingTime;

    /**
     * Last reading delay during current check interval
     */
    private long readingTime;

    /**
     * Long life written bytes
     */
    private final AtomicLong cumulativeWrittenBytes = new AtomicLong();

    /**
     * Long life read bytes
     */
    private final AtomicLong cumulativeReadBytes = new AtomicLong();

    /**
     * Last Time where cumulative bytes where reset to zero: this time is a real EPOC time (informative only)
     */
    private long lastCumulativeTime;

    /**
     * Last writing bandwidth
     */
    private long lastWriteThroughput;

    /**
     * Last reading bandwidth
     */
    private long lastReadThroughput;

    /**
     * Last Time Check taken
     */
    final AtomicLong lastTime = new AtomicLong();

    /**
     * Last written bytes number during last check interval
     */
    private volatile long lastWrittenBytes;

    /**
     * Last read bytes number during last check interval
     */
    private volatile long lastReadBytes;

    /**
     * Last future writing time during last check interval
     */
    private volatile long lastWritingTime;

    /**
     * Last reading time during last check interval
     */
    private volatile long lastReadingTime;

Frequently Asked Questions

What is the TrafficCounter class?
TrafficCounter is a class in the netty codebase, defined in handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java.
Where is TrafficCounter defined?
TrafficCounter is defined in handler/src/main/java/io/netty/handler/traffic/TrafficCounter.java at line 38.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free