Commit c6ea3739 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 58c2e39a
......@@ -27,6 +27,8 @@ import (
"sync"
"time"
"github.com/pkg/errors"
"lab.nexedi.com/kirr/neo/go/neo"
"lab.nexedi.com/kirr/neo/go/zodb"
"lab.nexedi.com/kirr/neo/go/xcommon/log"
......@@ -454,7 +456,15 @@ func (stor *Storage) serveClient(ctx context.Context, req neo.Request) {
// TODO += timeout -> go away if inactive
req, err = link.Recv1()
if err != nil {
log.Error(ctx, err)
switch errors.Cause(err) {
// XXX closed by main or peer down - all logged by main called
// XXX review
case neo.ErrLinkDown, neo.ErrLinkClosed:
// ok
default:
log.Error(ctx, err)
}
return
}
}
......
......@@ -223,8 +223,8 @@ N=`seq 2` # XXX repeat benchmarks N time
# time1 <url> - run benchmarks on the URL once
bench1() {
url=$1
time demo-zbigarray read $url
./zsha1.py $url
# time demo-zbigarray read $url
# ./zsha1.py $url
if [[ $url == zeo://* ]]; then
echo "(skipping zsha1.go on ZEO -- Cgo does not support zeo:// protocol)"
return
......
......@@ -66,7 +66,8 @@ loop:
}
tend := time.Now()
δt := tend.Sub(tstart)
fmt.Printf("%x ; oid=0..%d nread=%d t=%s x=zsha1.go\n",
m.Sum(nil), oid-1, nread, tend.Sub(tstart))
fmt.Printf("%x ; oid=0..%d nread=%d t=%s (%s / object) x=zsha1.go\n",
m.Sum(nil), oid-1, nread, δt, δt / time.Duration(oid)) // XXX /oid cast ?
}
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""zsha1 - compute sha1 of whole latest objects stream in a ZODB database"""
from __future__ import print_function
......@@ -38,9 +39,10 @@ def main():
oid += 1
tend = time()
dt = tend - tstart
print('%s ; oid=0..%d nread=%d t=%.3fs x=zsha1.py' % \
(m.hexdigest(), oid-1, nread, tend - tstart))
print('%s ; oid=0..%d nread=%d t=%.3fs (%.1fμs / object) x=zsha1.py' % \
(m.hexdigest(), oid-1, nread, dt, dt * 1E6 / oid))
if __name__ == '__main__':
......
......@@ -67,6 +67,13 @@ func (d Depth) Infof(ctx context.Context, format string, argv ...interface{}) {
glog.InfoDepth(int(d+1), withTask(ctx, fmt.Sprintf(format, argv...))...)
}
func (d Depth) Warning(ctx context.Context, argv ...interface{}) {
glog.WarningDepth(int(d+1), withTask(ctx, argv...)...)
}
func (d Depth) Warningf(ctx context.Context, format string, argv ...interface{}) {
glog.WarningDepth(int(d+1), withTask(ctx, fmt.Sprintf(format, argv...))...)
}
func (d Depth) Error(ctx context.Context, argv ...interface{}) {
glog.ErrorDepth(int(d+1), withTask(ctx, argv...)...)
}
......@@ -78,15 +85,17 @@ func (d Depth) Errorf(ctx context.Context, format string, argv ...interface{}) {
func Info(ctx context.Context, argv ...interface{}) { Depth(1).Info(ctx, argv...) }
func Warning(ctx context.Context, argv ...interface{}) { Depth(1).Warning(ctx, argv...) }
func Error(ctx context.Context, argv ...interface{}) { Depth(1).Error(ctx, argv...) }
func Infof(ctx context.Context, format string, argv ...interface{}) {
Depth(1).Infof(ctx, format, argv...)
}
func Warningf(ctx context.Context, format string, argv ...interface{}) {
Depth(1).Warningf(ctx, format, argv...)
}
func Errorf(ctx context.Context, format string, argv ...interface{}) {
Depth(1).Errorf(ctx, format, argv...)
}
// TODO Warningf, ...
......@@ -53,7 +53,7 @@ func running(ctxp *context.Context, name string) func(*error) {
// XXX is it good idea to log to error here? (not in above layer)
// XXX what is error here could be not so error above
// XXX or we still want to log all errors - right?
log.Depth(1).Error(ctx, "## ", *errp) // XXX "::" temp
log.Depth(1).Warning(ctx, "## ", *errp) // XXX "::" temp
} else {
log.Depth(1).Info(ctx, "done")
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment