Change in vdsm[master]: contrib: Add tool for getting hsm stats

nsoffer at redhat.com nsoffer at redhat.com
Sun Mar 15 13:26:35 UTC 2015


Nir Soffer has uploaded a new change for review.

Change subject: contrib: Add tool for getting hsm stats
......................................................................

contrib: Add tool for getting hsm stats

This is a very simple tool showing historgam of hsm calls in the given
log files.

Example:

  $ hsmstat vdsm.log.1 vdsm.log.2
    8515  getVolumeSize
    2258  repoStats
      51  getVolumeInfo
      30  getVolumesList
      19  teardownImage
  ...

We can get same output or better using logdb by writing some smart sql.

Change-Id: Ia6013da71ca96535b98edace8577a4d8bb529465
Signed-off-by: Nir Soffer <nsoffer at redhat.com>
---
A contrib/hsmstat
1 file changed, 39 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/48/38748/1

diff --git a/contrib/hsmstat b/contrib/hsmstat
new file mode 100755
index 0000000..d3400d2
--- /dev/null
+++ b/contrib/hsmstat
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+#
+# Copyright 2015 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+#
+# Refer to the README and COPYING files for full details of the license
+#
+
+from collections import defaultdict
+import fileinput
+import re
+
+verb_re = re.compile(r" Run and protect: (?P<name>.+)\(")
+
+verbs = defaultdict(int)
+
+for line in fileinput.input():
+    match = verb_re.search(line)
+    if match:
+        name = match.group('name')
+        verbs[name] += 1
+
+histogram = sorted(((count, verb) for verb, count in verbs.iteritems()),
+                   reverse=True)
+for count, name in histogram:
+    print "  %6d  %s" % (count, name)


-- 
To view, visit https://gerrit.ovirt.org/38748
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia6013da71ca96535b98edace8577a4d8bb529465
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Nir Soffer <nsoffer at redhat.com>


More information about the vdsm-patches mailing list