Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Goshimmer_without_tipselection
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
COLLET Ismael
Goshimmer_without_tipselection
Commits
06cc0182
Commit
06cc0182
authored
4 years ago
by
Levente Pap
Browse files
Options
Downloads
Patches
Plain Diff
Add DBStats method to msg layer tangle
parent
45850860
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
packages/binary/messagelayer/tangle/tangle.go
+19
-0
19 additions, 0 deletions
packages/binary/messagelayer/tangle/tangle.go
with
19 additions
and
0 deletions
packages/binary/messagelayer/tangle/tangle.go
+
19
−
0
View file @
06cc0182
...
...
@@ -135,6 +135,25 @@ func (tangle *Tangle) Prune() error {
return
nil
}
// DBStats returns the number of solid messages and total number of messages in the database, furthermore the average time it takes to solidify messages.
func
(
tangle
*
Tangle
)
DBStats
()
(
solidCount
int
,
messageCount
int
,
avgSolidificationTime
float64
)
{
var
sumSolidificationTime
time
.
Duration
tangle
.
messageMetadataStorage
.
ForEach
(
func
(
key
[]
byte
,
cachedObject
objectstorage
.
CachedObject
)
bool
{
defer
cachedObject
.
Release
()
cachedMessageMetadata
:=
&
CachedMessageMetadata
{
CachedObject
:
cachedObject
}
msgMetaData
:=
cachedMessageMetadata
.
Unwrap
()
messageCount
++
received
:=
msgMetaData
.
ReceivedTime
()
if
msgMetaData
.
IsSolid
()
{
solidCount
++
sumSolidificationTime
+=
msgMetaData
.
solidificationTime
.
Sub
(
received
)
}
return
true
})
avgSolidificationTime
=
float64
(
sumSolidificationTime
.
Milliseconds
())
/
float64
(
solidCount
)
return
}
// worker that stores the message and calls the corresponding storage events.
func
(
tangle
*
Tangle
)
storeMessageWorker
(
msg
*
message
.
Message
)
{
// store message
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment