very experimental attempt to find threshold breach using chronos modification

This commit is contained in:
benbierens 2023-07-07 07:49:30 +02:00
parent 91bb6daa19
commit 8cf22775e9
No known key found for this signature in database
GPG Key ID: FE44815D96D0A1AA
4 changed files with 2341 additions and 1 deletions

View File

@ -337,6 +337,30 @@ proc initRestApi*(node: CodexNodeRef, conf: CodexConf, loopMeasure: LoopMeasure)
trace "debug/peer returning peer record"
return RestApiResponse.response($json)
when defined(chronosDurationThreshold):
var breaches = newSeq[string]()
proc onBreach(stackTrace: string, durationUs: int64) =
error "Duration threshold breached", durationUs, stackTrace
breaches.add($durationUs & " usecs at " & stackTrace)
setChronosDurationThresholdBreachedHandler(onBreach)
router.api(
MethodGet,
"/api/codex/v1/debug/loop") do () -> RestApiResponse:
let jarray = newJArray()
for entry in breaches:
jarray.add(%*entry)
# "entry": entry
# })
let jobj = %*{
"breaches": jarray
}
return RestApiResponse.response($jobj)
router.api(
MethodGet,
"/api/codex/v1/sales/slots") do () -> RestApiResponse:

1041
docker/asyncfutures2.nim Normal file

File diff suppressed because it is too large Load Diff

1273
docker/asyncloop.nim Normal file

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ ARG BUILDER=ubuntu:lunar-20230415
ARG IMAGE=${BUILDER}
ARG BUILD_HOME=/src
ARG MAKE_PARALLEL=${MAKE_PARALLEL:-4}
ARG NIMFLAGS="${NIMFLAGS:-"-d:disableMarchNative -d:chronosFutureTracking -d:codex_enable_api_debug_peers=true"}"
ARG NIMFLAGS="${NIMFLAGS:-"-d:disableMarchNative -d:chronosDurationThreshold=1000000 -d:chronosFutureTracking -d:codex_enable_api_debug_peers=true"}"
ARG APP_HOME=/codex
ARG NAT_IP_AUTO=${NAT_IP_AUTO:-false}
@ -21,6 +21,8 @@ WORKDIR ${BUILD_HOME}
COPY . .
RUN make clean
RUN make -j ${MAKE_PARALLEL} update
COPY docker/asyncfutures2.nim ./vendor/nim-chronos/chronos
COPY docker/asyncloop.nim ./vendor/nim-chronos/chronos
RUN make -j ${MAKE_PARALLEL}
# Create