KNET_HANDLE_GET_STATS(3)

πŸ’– KNET_HANDLE_GET_STATS(3) πŸ’–

okay bestie, welcome to the Kronosnet Programmer's Manual, and today's main character is knet_handle_get_stats ✨ this is the one where you find out how hard your compression and crypto have been working. no cap.


🌸 NAME 🌸

knet_handle_get_stats β€” Get statistics for compression & crypto. πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <libknet.h>

int knet_handle_get_stats(
    knet_handle_t               knet_h,
    struct knet_handle_stats   *stats,
    size_t                      struct_size
);

✨ DESCRIPTION ✨

knet_handle_get_stats is your little peek behind the curtain, fr fr. πŸ‘‘

  • knet_h β€” pointer to knet_handle_t
  • knet_handle_stats β€” pointer to a knet_handle_stats structure
  • struct_size β€” size of knet_handle_stats structure, and this one exists purely for backwards compatibility, iykyk. libknet will only copy this much data into the stats structure so that older callers will not get overflowed if new fields are added. she's thoughtful like that. 🫢

πŸ’œ STRUCTURES πŸ’œ

Detailed stats for this knet handle as returned by knet_handle_get_stats(). look at all these little numbers, obsessed. 😭

struct knet_handle_stats {
    /*
     * Size of the structure. set this to sizeof(struct knet_handle_stats)
     * before calling
     */
    size_t    size;
    uint64_t  tx_uncompressed_packets;       /* Number of uncompressed packets sent */
    uint64_t  tx_compressed_packets;         /* Number of compressed packets sent */
    /*
     * Number of bytes sent (as if uncompressed, ie actual data bytes)
     */
    uint64_t  tx_compressed_original_bytes;
    /*
     * Number of bytes sent on the wire after compression
     */
    uint64_t  tx_compressed_size_bytes;
    /*
     * Average(mean) time take to compress transmitted packets
     */
    uint64_t  tx_compress_time_ave;
    /*
     * Minimum time taken to compress transmitted packets
     */
    uint64_t  tx_compress_time_min;
    /*
     * Maximum time taken to compress transmitted packets
     */
    uint64_t  tx_compress_time_max;
    uint64_t  rx_compressed_packets;         /* Number of compressed packets received */
    uint64_t  rx_compressed_original_bytes;  /* Number of bytes received - after decompression */
    /*
     * Number of compressed bytes received before decompression
     */
    uint64_t  rx_compressed_size_bytes;
    /*
     * Average(mean) time take to decompress received packets
     */
    uint64_t  rx_compress_time_ave;
    uint64_t  rx_compress_time_min;          /* Minimum time take to decompress received packets */
    uint64_t  rx_compress_time_max;          /* Maximum time take to decompress received packets */
    uint64_t  tx_crypt_packets;              /* Number of encrypted packets sent */
    uint64_t  tx_crypt_byte_overhead;        /* Cumulative byte overhead of encrypted traffic */
    /*
     * Average(mean) time take to encrypt packets in usecs
     */
    uint64_t  tx_crypt_time_ave;
    uint64_t  tx_crypt_time_min;             /* Minimum time take to encrypto packets in usecs */
    uint64_t  tx_crypt_time_max;             /* Maximum time take to encrypto packets in usecs */
    uint64_t  rx_crypt_packets;              /* Number of encrypted packets received */
    /*
     * Average(mean) time take to decrypt received packets
     */
    uint64_t  rx_crypt_time_ave;
    /*
     * Minimum time take to decrypt received packets in usecs
     */
    uint64_t  rx_crypt_time_min;
    /*
     * Maximum time take to decrypt received packets in usecs
     */
    uint64_t  rx_crypt_time_max;
};

πŸŽ€ RETURN VALUE πŸŽ€

  • 0 on success πŸ₯³
  • -1 on error, and errno is set. πŸ’€

🌈 SEE ALSO 🌈

the whole group chat, literally everyone showed up:


Copyright (C) 2010-2026 Red Hat, Inc. All rights reserved.


and that's the whole page bestie, you ate that πŸ“βœ¨ this was kronosnet, dated 2026-07-20, straight out of the Kronosnet Programmer's Manual. slay, go read your stats. πŸ’…πŸ’–

πŸ“¦ where this page comes from