Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
satella
Commits
1560e2ac
Commit
1560e2ac
authored
1 year ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
made CPUProfileBuilderThread use SingleStartThread
Change-Id: Ibb88378f0d807688fefb3270c548ef077395a6ca
parent
d88afa20
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
satella/instrumentation/cpu_time/collector.py
+3
-9
3 additions, 9 deletions
satella/instrumentation/cpu_time/collector.py
with
3 additions
and
9 deletions
satella/instrumentation/cpu_time/collector.py
+
3
−
9
View file @
1560e2ac
...
...
@@ -3,13 +3,13 @@ from __future__ import annotations
import
collections
import
multiprocessing
import
os
import
threading
import
time
import
typing
as
tp
import
psutil
from
satella.coding
import
for_argument
from
satella.coding.concurrent
import
SingleStartThread
from
satella.coding.decorators
import
repeat_forever
from
satella.coding.transforms
import
percentile
from
satella.time
import
parse_time_string
...
...
@@ -22,13 +22,13 @@ pCPUtimes = collections.namedtuple('pcputimes',
'
iowait
'
])
class
_CPUProfileBuilderThread
(
threading
.
Thread
):
class
_CPUProfileBuilderThread
(
SingleStart
Thread
):
"""
A CPU profile builder thread and a core singleton object to use.
:param window_seconds: the amount of seconds for which to collect data.
Generally, this should be the interval during which your system cycles through all of
it
'
s load, eg. if it asks it
'
s devices each 5 minutes, the interval should be 300 seconds.
its load, eg. if it asks its devices each 5 minutes, the interval should be 300 seconds.
Or a time string.
:param refresh_each: time of seconds to sleep between rebuilding of profiles, or a time string.
"""
...
...
@@ -56,12 +56,6 @@ class _CPUProfileBuilderThread(threading.Thread):
_CPUProfileBuilderThread
.
thread
.
start
()
return
_CPUProfileBuilderThread
.
thread
def
start
(
self
)
->
None
:
if
self
.
started
:
return
self
.
started
=
True
super
().
start
()
def
save_load
(
self
,
times
:
pCPUtimes
)
->
None
:
while
len
(
self
.
own_load_average
)
>
3
and
\
self
.
own_load_average
[
0
][
0
]
<
self
.
own_load_average
[
-
1
][
0
]
-
self
.
window_size
:
...
...
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