20 #include <freerdp/config.h>
24 double metrics_write_bytes(rdpMetrics* metrics, UINT32 UncompressedBytes, UINT32 CompressedBytes)
26 double CompressionRatio = 0.0;
28 metrics->TotalUncompressedBytes += UncompressedBytes;
29 metrics->TotalCompressedBytes += CompressedBytes;
31 if (UncompressedBytes != 0)
32 CompressionRatio = ((double)CompressedBytes) / ((double)UncompressedBytes);
33 if (metrics->TotalUncompressedBytes != 0)
34 metrics->TotalCompressionRatio =
35 ((double)metrics->TotalCompressedBytes) / ((double)metrics->TotalUncompressedBytes);
37 return CompressionRatio;
40 rdpMetrics* metrics_new(rdpContext* context)
42 rdpMetrics* metrics = NULL;
44 metrics = (rdpMetrics*)calloc(1,
sizeof(rdpMetrics));
48 metrics->context = context;
54 void metrics_free(rdpMetrics* metrics)