Files
simplexmq/src/Simplex/FileTransfer/Chunks.hs
T
spaced4ndy ae8e1c5e9a agent: servers stats improvements, fixes (#1208)
* agent: reset stats startedAt time in memory

* getAgentSubsSummary

* change sub counting

* ack statistics

* add import

* instance

* Revert "instance"

This reverts commit 1f63740d56.

* Revert "add import"

This reverts commit ef72df8014.

* modify sub counting

* modify conn creation counting

* use int64

* file size stats

* remove import

* ack err counting

* conn del stats

* format

* new data

* add data

* toKB

* restore connCompleted

* use Int for counts

* use rq from scope

* remove getAgentSubsSummary

* fix connCompleted

* fix

* revert disabling stats

* use srv from scope

* combine ack stats

* modify

* comment

* count subs

* refactor

---------

Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com>
2024-07-03 12:36:15 +01:00

40 lines
729 B
Haskell

module Simplex.FileTransfer.Chunks where
import Data.Word (Word32)
serverChunkSizes :: [Word32]
serverChunkSizes = [chunkSize0, chunkSize1, chunkSize2, chunkSize3]
{-# INLINE serverChunkSizes #-}
chunkSize0 :: Word32
chunkSize0 = kb 64
{-# INLINE chunkSize0 #-}
chunkSize1 :: Word32
chunkSize1 = kb 256
{-# INLINE chunkSize1 #-}
chunkSize2 :: Word32
chunkSize2 = mb 1
{-# INLINE chunkSize2 #-}
chunkSize3 :: Word32
chunkSize3 = mb 4
{-# INLINE chunkSize3 #-}
kb :: Integral a => a -> a
kb n = 1024 * n
{-# INLINE kb #-}
toKB :: Integral a => a -> a
toKB n = n `div` 1024
{-# INLINE toKB #-}
mb :: Integral a => a -> a
mb n = 1024 * kb n
{-# INLINE mb #-}
gb :: Integral a => a -> a
gb n = 1024 * mb n
{-# INLINE gb #-}