|
ascii-chat 0.6.0
Real-time terminal-based video chat with ASCII art conversion
|
Server performance statistics tracking. More...
Go to the source code of this file.
Data Structures | |
| struct | server_stats_t |
| Server performance statistics structure. More... | |
Functions | |
| void * | stats_logger_thread (void *arg) |
| Main statistics collection and reporting thread function. | |
| int | stats_init (void) |
| Initialize the stats mutex. | |
| void | stats_cleanup (void) |
| Cleanup the stats mutex. | |
| void | update_server_stats (void) |
| Update global server statistics (placeholder) | |
| void | log_server_stats (void) |
| Log comprehensive server statistics summary. | |
Variables | |
| server_stats_t | g_stats |
| Global server statistics structure. | |
| mutex_t | g_stats_mutex |
| Mutex protecting global server statistics. | |
Server performance statistics tracking.
This header provides server-side performance statistics tracking including frame capture/send rates, bandwidth metrics, and performance counters.
Definition in file stats.h.
| void log_server_stats | ( | void | ) |
Log comprehensive server statistics summary.
Outputs a formatted summary of server performance statistics including frame processing rates, throughput metrics, and system health indicators. This function provides operational visibility into server performance.
FRAME PROCESSING METRICS:
PERFORMANCE INDICATORS:
Definition at line 559 of file stats.c.
References server_stats_t::avg_capture_fps, server_stats_t::avg_send_fps, server_stats_t::frames_captured, server_stats_t::frames_dropped, server_stats_t::frames_sent, g_stats, g_stats_mutex, log_info, mutex_lock, and mutex_unlock.
Referenced by stats_logger_thread().
| void stats_cleanup | ( | void | ) |
Cleanup the stats mutex.
Definition at line 195 of file stats.c.
References g_stats_mutex, and mutex_destroy().
Referenced by server_main().
| int stats_init | ( | void | ) |
Initialize the stats mutex.
Definition at line 184 of file stats.c.
References g_stats_mutex, and mutex_init().
Referenced by server_main().
| void * stats_logger_thread | ( | void * | arg | ) |
Main statistics collection and reporting thread function.
This background thread performs continuous monitoring of server performance and logs comprehensive statistics reports at regular intervals. It operates independently of the main server processing threads to avoid performance impact.
NON-BLOCKING DATA COLLECTION:
RESPONSIVE SHUTDOWN:
CLIENT STATISTICS:
BUFFER POOL METRICS:
PACKET QUEUE PERFORMANCE:
HASH TABLE EFFICIENCY:
EXTENSIVE DEBUG LOGGING: The function contains detailed debug printf statements for troubleshooting threading issues. This instrumentation helps diagnose:
DEBUG OUTPUT INCLUDES:
| arg | Thread argument (unused - required by thread interface) |
Definition at line 332 of file stats.c.
References client_info::active, asciichat_errno_cleanup(), asciichat_error_stats_print(), client_info::audio_queue, client_info::client_id, client_manager_t::clients, video_frame_stats_t::drop_rate, video_frame_stats_t::dropped_frames, g_client_manager, g_client_manager_rwlock, g_server_should_exit, lock_debug_is_initialized(), log_info, log_server_stats(), MAX_CLIENTS, client_info::outgoing_video_buffer, packet_queue_get_stats(), platform_sleep_usec(), rwlock_rdlock, rwlock_rdunlock, safe_snprintf(), video_frame_stats_t::total_frames, and video_frame_get_stats().
Referenced by server_main().
| void update_server_stats | ( | void | ) |
Update global server statistics (placeholder)
This function is intended to update the global server statistics structure with current performance metrics. Currently unimplemented but provides the framework for centralized statistics updates.
IMPLEMENTATION STRATEGY:
INTEGRATION POINTS:
Used by packet queue systems for throughput tracking
Definition at line 478 of file stats.c.
References client_info::active, client_info::client_id, client_manager_t::clients, video_frame_stats_t::dropped_frames, server_stats_t::frames_captured, server_stats_t::frames_dropped, client_info::frames_sent, server_stats_t::frames_sent, g_client_manager, g_client_manager_rwlock, g_stats, g_stats_mutex, MAX_CLIENTS, mutex_lock, mutex_unlock, client_info::outgoing_video_buffer, rwlock_rdlock, rwlock_rdunlock, and video_frame_get_stats().
|
extern |
Global server statistics structure.
Maintains aggregated performance metrics for the entire server including frame processing rates, client counts, and system health indicators. All access to this structure must be protected by g_stats_mutex.
CONTENTS:
Definition at line 159 of file stats.c.
Referenced by log_server_stats(), server_main(), and update_server_stats().
|
extern |
Mutex protecting global server statistics.
Ensures thread-safe access to g_stats structure from both the statistics collection thread and any operational threads that update counters. Uses standard mutex (not reader-writer) due to relatively infrequent access.
Definition at line 168 of file stats.c.
Referenced by log_server_stats(), server_main(), stats_cleanup(), stats_init(), and update_server_stats().