1 /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. 4 */ 5 6 #ifndef CRAS_SERVER_METRICS_H_ 7 #define CRAS_SERVER_METRICS_H_ 8 9 #include <stdbool.h> 10 11 #include "cras_iodev.h" 12 #include "cras_rstream.h" 13 14 extern const char kNoCodecsFoundMetric[]; 15 16 /* Logs if connected HFP headset supports wideband speech. */ 17 int cras_server_metrics_hfp_wideband_support(bool supported); 18 19 /* Logs the number of packet loss per 1000 packets under HFP capture. */ 20 int cras_server_metrics_hfp_packet_loss(float packet_loss_ratio); 21 22 /* Logs runtime of a device. */ 23 int cras_server_metrics_device_runtime(struct cras_iodev *iodev); 24 25 /* Logs the highest delay time of a device. */ 26 int cras_server_metrics_highest_device_delay( 27 unsigned int hw_level, unsigned int largest_cb_level, 28 enum CRAS_STREAM_DIRECTION direction); 29 30 /* Logs the highest hardware level of a device. */ 31 int cras_server_metrics_highest_hw_level(unsigned hw_level, 32 enum CRAS_STREAM_DIRECTION direction); 33 34 /* Logs the longest fetch delay of a stream in millisecond. */ 35 int cras_server_metrics_longest_fetch_delay(unsigned delay_msec); 36 37 /* Logs the number of underruns of a device. */ 38 int cras_server_metrics_num_underruns(unsigned num_underruns); 39 40 /* Logs the frequency of missed callback. */ 41 int cras_server_metrics_missed_cb_frequency(const struct cras_rstream *stream); 42 43 /* Logs the missed callback event. */ 44 int cras_server_metrics_missed_cb_event(const struct cras_rstream *stream); 45 46 /* Logs the stream configurations from clients. */ 47 int cras_server_metrics_stream_config(struct cras_rstream_config *config); 48 49 /* Logs the number of busyloops for different time periods. */ 50 int cras_server_metrics_busyloop(struct timespec *ts, unsigned count); 51 52 /* Initialize metrics logging stuff. */ 53 int cras_server_metrics_init(); 54 55 #endif /* CRAS_SERVER_METRICS_H_ */ 56