From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YT6Yl-00064H-Gn for qemu-devel@nongnu.org; Wed, 04 Mar 2015 05:29:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YT6Yh-0006ks-F4 for qemu-devel@nongnu.org; Wed, 04 Mar 2015 05:29:47 -0500 From: "Dr. David Alan Gilbert (git)" Date: Wed, 4 Mar 2015 10:29:35 +0000 Message-Id: <1425464979-20578-1-git-send-email-dgilbert@redhat.com> Subject: [Qemu-devel] [RFC v2 0/4] Rolling statistics utilities List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: amit.shah@redhat.com, armbru@redhat.com, qemu-block@nongnu.org, quintela@redhat.com From: "Dr. David Alan Gilbert" Hi, This is an attempt at a generic rolling statistics utility to allow data (e.g. bandwidth usage, times etc) to be collected easily. They hold some basic values (min/max/mean/weighted mean) and the last 'n' raw values. I'd like to use this maybe with fault-tolerance code and want to read the means within qemu but also want to provide the values to higher levels of the stack and to watch what is going on. This version is lightly tested, and I'm still more interested in if it's the right shape/idea rather than a detailed review. I've included an example use in watching the 'expected downtime' in migration; rather than the current single value we get: HMP: expected downtime stats: Min/Max: 222, 1634 Mean: 983.8 (Weighted: 1005.1253) Count: 141 Values: 1248@39356292, 981@39356395, 774@39356497, 876@39356599, 1040@39356702 QMP: "expected-downtime-stats": { "min": 222, "count": 378, "mean": 1100.2, "max": 1942, "weighted-mean": 1115.710848, "values": [ { "tag": 39380740, "value": 1118 }, { "tag": 39380842, "value": 953 }, { "tag": 39380945, "value": 1017 }, { "tag": 39381048, "value": 1336 }, { "tag": 39381150, "value": 1077 } ] } Dave RFC v2 Wired up a qapi type so that the output is done via qapi; it still seems best to have a separate type with the data and the locking etc. Although that has lost my test harness that was built on my manual formatters. Dr. David Alan Gilbert (4): RollingStats qapi type Rolling statistics utilities hmp: Add a helper function for printing out a Rolling Statistics set Example use of rolling statistics in migration hmp.c | 24 +++++ include/migration/migration.h | 1 + include/qemu/rolling-stats.h | 87 ++++++++++++++++ include/qemu/typedefs.h | 1 + migration/migration.c | 15 +++ qapi-schema.json | 36 ++++++- util/Makefile.objs | 1 + util/rolling-stats.c | 236 ++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 400 insertions(+), 1 deletion(-) create mode 100644 include/qemu/rolling-stats.h create mode 100644 util/rolling-stats.c -- 2.1.0