mirror of https://github.com/fail2ban/fail2ban
- Added date template hits summary
- Desactivated garbage collector while benchmarking git-svn-id: https://fail2ban.svn.sourceforge.net/svnroot/fail2ban/trunk@345 a942ae1a-1317-0410-a47c-b1dcaea8d6050.x
parent
068dea8971
commit
4eb611dd46
|
@ -25,7 +25,7 @@ __date__ = "$Date: 2006-08-23 21:53:09 +0200 (Wed, 23 Aug 2006) $"
|
||||||
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
__copyright__ = "Copyright (c) 2004 Cyril Jaquier"
|
||||||
__license__ = "GPL"
|
__license__ = "GPL"
|
||||||
|
|
||||||
import locale, getopt, sys, time, logging
|
import locale, getopt, sys, time, logging, gc
|
||||||
|
|
||||||
# Inserts our own modules path first in the list
|
# Inserts our own modules path first in the list
|
||||||
# fix for bug #343821
|
# fix for bug #343821
|
||||||
|
@ -67,7 +67,12 @@ class Fail2banRegex:
|
||||||
ipList = ipList + " " + i[0]
|
ipList = ipList + " " + i[0]
|
||||||
print "IP :" + ipList
|
print "IP :" + ipList
|
||||||
print
|
print
|
||||||
|
print "Date template hits:"
|
||||||
|
for template in self.filter.dateDetector.templates:
|
||||||
|
print `template.getHits()` + " hit: " + template.getName()
|
||||||
|
print
|
||||||
print "Benchmark. Executing 1000..."
|
print "Benchmark. Executing 1000..."
|
||||||
|
gc.disable()
|
||||||
total = 0
|
total = 0
|
||||||
maxValue = 0
|
maxValue = 0
|
||||||
maxPos = 0
|
maxPos = 0
|
||||||
|
@ -85,6 +90,7 @@ class Fail2banRegex:
|
||||||
maxValue = max(maxValue, diff)
|
maxValue = max(maxValue, diff)
|
||||||
if maxValue == diff:
|
if maxValue == diff:
|
||||||
maxPos = i
|
maxPos = i
|
||||||
|
gc.enable()
|
||||||
print "Performance"
|
print "Performance"
|
||||||
print "Avg: " + `total / 1000` + " ms"
|
print "Avg: " + `total / 1000` + " ms"
|
||||||
print "Max: " + `maxValue` + " ms (Run " + `maxPos` + ")"
|
print "Max: " + `maxValue` + " ms (Run " + `maxPos` + ")"
|
||||||
|
|
Loading…
Reference in New Issue