From 5ee668516accea199077b2d53b312b64ed48fae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C8=98tefan=20Talpalaru?= Date: Wed, 10 Jul 2019 01:58:18 +0200 Subject: [PATCH] add nim-metrics --- .gitmodules | 5 +++++ nim.cfg | 1 + nimbus/nimbus.nim | 4 +++- nimbus/vm/interpreter/opcodes_impl.nim | 6 +++--- vendor/nim-eth | 2 +- vendor/nim-metrics | 1 + 6 files changed, 14 insertions(+), 5 deletions(-) create mode 160000 vendor/nim-metrics diff --git a/.gitmodules b/.gitmodules index bbacfa590..6dab73e6f 100644 --- a/.gitmodules +++ b/.gitmodules @@ -132,3 +132,8 @@ path = vendor/news url = https://github.com/tormund/news branch = master +[submodule "vendor/nim-metrics"] + path = vendor/nim-metrics + url = https://github.com/status-im/nim-metrics.git + ignore = dirty + branch = master diff --git a/nim.cfg b/nim.cfg index daa96d607..8b04f4b94 100644 --- a/nim.cfg +++ b/nim.cfg @@ -15,4 +15,5 @@ --threads:on --excessiveStackTrace:on +-d:metrics # enable metric collection diff --git a/nimbus/nimbus.nim b/nimbus/nimbus.nim index 97e574d61..329d84868 100644 --- a/nimbus/nimbus.nim +++ b/nimbus/nimbus.nim @@ -127,7 +127,9 @@ proc start(): NimbusObject = # periodically log internal statistics let statsInterval = 10.seconds proc printStats(udata: pointer) {.closure, gcsafe.} = - info "stats", nimbusStats + {.gcsafe.}: + let peers = peerGauge.value.int64 + info "stats", peers addTimer(Moment.fromNow(statsInterval), printStats) addTimer(Moment.fromNow(statsInterval), printStats) diff --git a/nimbus/vm/interpreter/opcodes_impl.nim b/nimbus/vm/interpreter/opcodes_impl.nim index 5039b7692..87536df04 100644 --- a/nimbus/vm/interpreter/opcodes_impl.nim +++ b/nimbus/vm/interpreter/opcodes_impl.nim @@ -596,14 +596,14 @@ proc setupCreate(computation: BaseComputation, memPos, len: int, value: Uint256, some(computation.getFork)) template genCreate(callName: untyped, opCode: Op): untyped = - op callName, inline = false, value, startPosition, size: + op callName, inline = false, val, startPosition, size: ## 0xf0, Create a new account with associated code. let (memPos, len) = (startPosition.safeInt, size.safeInt) - if not computation.canTransfer(memPos, len, value, opCode): + if not computation.canTransfer(memPos, len, val, opCode): push: 0 return - var childComp = setupCreate(computation, memPos, len, value, opCode) + var childComp = setupCreate(computation, memPos, len, val, opCode) if childComp.isNil: return continuation(childComp): diff --git a/vendor/nim-eth b/vendor/nim-eth index 1797b7635..93637fa06 160000 --- a/vendor/nim-eth +++ b/vendor/nim-eth @@ -1 +1 @@ -Subproject commit 1797b7635124875fe0e212d7df5bd1836f22cbaa +Subproject commit 93637fa0609129d8257adab022a3d7f1857a6516 diff --git a/vendor/nim-metrics b/vendor/nim-metrics new file mode 160000 index 000000000..bf5c678fa --- /dev/null +++ b/vendor/nim-metrics @@ -0,0 +1 @@ +Subproject commit bf5c678fa070c3582093b2b5785abee367c9934a