netatalk: afp_tcp_analytics.c File Reference

netatalk 4.5.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
afp_tcp_analytics.c File Reference
`#include "afp_tcp_analytics.h"`
`#include <stdio.h>`
`#include <string.h>`
`#include <netinet/tcp.h>`
`#include <sys/socket.h>`
`#include <arpa/inet.h>`
`#include "dsi.h"`

## Macros
#define | KILOBYTE 1024
#define | MEGABYTE (KILOBYTE*KILOBYTE)

## Functions
void | tcp_analytics_init (TcpAnalyticsSession *session, TcpOutputFormat format, int enable_session)
| Initialize TCP analytics session.
int | tcp_analytics_capture (CONN *conn, TcpMetrics *metrics)
| Capture TCP metrics from connection socket via getsockopt().
int | tcp_analytics_session_start (TcpAnalyticsSession *session, CONN *conn)
| Mark session start - capture "initial" metrics for size sweep mode.
int | tcp_analytics_test_start (TcpAnalyticsSession *session, CONN *conn, off_t file_size)
| Mark test start - capture "before" metrics.
static void | print_per_test_comparison (const TcpAnalyticsSession *session)
| Print before/after TCP metrics comparison for single test.
int | tcp_analytics_test_end (TcpAnalyticsSession *session, CONN *conn)
| Mark test end - capture "after" metrics and print per-test comparison.
static void | print_session_summary (const TcpAnalyticsSession *session)
| Print initial/final TCP metrics summary for size sweep session.
int | tcp_analytics_session_end (TcpAnalyticsSession *session, CONN *conn)
| Mark session end - capture "final" metrics and print session summary.

## Macro Definition Documentation

## ◆ KILOBYTE

#define KILOBYTE 1024

## ◆ MEGABYTE

#define MEGABYTE (KILOBYTE*KILOBYTE)

## Function Documentation

## ◆ print_per_test_comparison()

void print_per_test_comparison | ( | const TcpAnalyticsSession * | session | ) |
| static

Print before/after TCP metrics comparison for single test.

## ◆ print_session_summary()

void print_session_summary | ( | const TcpAnalyticsSession * | session | ) |
| static

Print initial/final TCP metrics summary for size sweep session.

## ◆ tcp_analytics_capture()

int tcp_analytics_capture | ( | CONN * | conn,
|  | TcpMetrics * | metrics )

Capture TCP metrics from connection socket via getsockopt().

Note
  Supports Linux, FreeBSD, NetBSD, OpenBSD (TCP_INFO), macOS (TCP_CONNECTION_INFO)

## ◆ tcp_analytics_init()

void tcp_analytics_init | ( | TcpAnalyticsSession * | session,
|  | TcpOutputFormat | format,
|  | int | enable_session )

Initialize TCP analytics session.

Note
  Must be called before any other tcp_analytics functions

## ◆ tcp_analytics_session_end()

int tcp_analytics_session_end | ( | TcpAnalyticsSession * | session,
|  | CONN * | conn )

Mark session end - capture "final" metrics and print session summary.

## ◆ tcp_analytics_session_start()

int tcp_analytics_session_start | ( | TcpAnalyticsSession * | session,
|  | CONN * | conn )

Mark session start - capture "initial" metrics for size sweep mode.

## ◆ tcp_analytics_test_end()

int tcp_analytics_test_end | ( | TcpAnalyticsSession * | session,
|  | CONN * | conn )

Mark test end - capture "after" metrics and print per-test comparison.

## ◆ tcp_analytics_test_start()

int tcp_analytics_test_start | ( | TcpAnalyticsSession * | session,
|  | CONN * | conn,
|  | off_t | file_size )

Mark test start - capture "before" metrics.