mirror of
https://github.com/evennia/evennia.git
synced 2026-04-05 15:37:17 +02:00
Made lockhandler write lockwarnings to separate log file
This commit is contained in:
parent
f49f33d40d
commit
a143733ccf
2 changed files with 8 additions and 12 deletions
|
|
@ -113,6 +113,7 @@ from django.utils.translation import ugettext as _
|
|||
|
||||
__all__ = ("LockHandler", "LockException")
|
||||
|
||||
WARNING_LOG = "lockwarnings.log"
|
||||
|
||||
#
|
||||
# Exception class. This will be raised
|
||||
|
|
@ -232,12 +233,12 @@ class LockHandler(object):
|
|||
continue
|
||||
if access_type in locks:
|
||||
duplicates += 1
|
||||
wlist.append(_("Lock: access type '%(access_type)s' changed from '%(source)s' to '%(goal)s' " % \
|
||||
{"access_type":access_type, "source":locks[access_type][2], "goal":raw_lockstring}))
|
||||
wlist.append(_("LockHandler on %(obj)s: access type '%(access_type)s' changed from '%(source)s' to '%(goal)s' " % \
|
||||
{"obj":self.obj, "access_type":access_type, "source":locks[access_type][2], "goal":raw_lockstring}))
|
||||
locks[access_type] = (evalstring, tuple(lock_funcs), raw_lockstring)
|
||||
if wlist:
|
||||
# a warning text was set, it's not an error, so only report
|
||||
logger.log_warn("\n".join(wlist))
|
||||
logger.log_file("\n".join(wlist), WARNING_LOG)
|
||||
if elist:
|
||||
# an error text was set, raise exception.
|
||||
raise LockException("\n".join(elist))
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ class Memplot(ev.Script):
|
|||
t0 = (time.time() - self.db.starttime) / 60.0 # save in minutes
|
||||
|
||||
with open(LOGFILE, "a") as f:
|
||||
f.write("%s, %s, %s, %s\n" % (t0, rmem, vmem, total_num))
|
||||
f.write("%s, %s, %s, %s\n" % (t0, rmem, vmem, int(total_num)))
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
|
|
@ -43,19 +43,14 @@ if __name__ == "__main__":
|
|||
from matplotlib import pyplot as pp
|
||||
import numpy
|
||||
|
||||
data = numpy.genfromtxt(LOGFILE, delimiter=",")
|
||||
data = numpy.genfromtxt("../../../game/" + LOGFILE, delimiter=",")
|
||||
secs = data[:,0]
|
||||
rmem = data[:,1]
|
||||
vmem = data[:,2]
|
||||
nobj = data[:,3]
|
||||
|
||||
# correct for @reload
|
||||
#secs[359:] = secs[359:] + secs[358]
|
||||
|
||||
# count total amount of objects
|
||||
ntot = data[:,3].copy()
|
||||
#ntot[119:] = ntot[119:] + ntot[118] - ntot[119]
|
||||
#ntot[359:] = ntot[359:] + ntot[358] - ntot[359]
|
||||
#ntot = data[:,3].copy()
|
||||
|
||||
fig = pp.figure()
|
||||
ax1 = fig.add_subplot(111)
|
||||
|
|
@ -68,7 +63,7 @@ if __name__ == "__main__":
|
|||
|
||||
ax2 = ax1.twinx()
|
||||
ax2.plot(secs, nobj, "g--", label="objs in cache", lw=2)
|
||||
ax2.plot(secs, ntot, "r--", label="objs total", lw=2)
|
||||
#ax2.plot(secs, ntot, "r--", label="objs total", lw=2)
|
||||
ax2.set_ylabel("Number of objects")
|
||||
ax2.legend(loc="lower right")
|
||||
ax2.annotate("idmapper\nflush", xy=(70,480))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue