Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
settingsd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
settingsd
Commits
7108957e
Commit
7108957e
authored
Nov 08, 2010
by
Devaev Maxim
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed return value type of meminfo API from float to int
parent
1bf3cc02
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
7 deletions
+8
-7
fmod_statistics.py
plugins/functions/fmod_statistics.py
+8
-7
No files found.
plugins/functions/fmod_statistics.py
View file @
7108957e
...
...
@@ -51,19 +51,19 @@ class Memory(service.FunctionObject) :
### DBus methods ###
@service.functionMethod
(
MEMORY_METHODS_NAMESPACE
,
out_signature
=
"
d
"
)
@service.functionMethod
(
MEMORY_METHODS_NAMESPACE
,
out_signature
=
"
i
"
)
def
memoryFull
(
self
)
:
return
self
.
meminfoSum
(
"MemTotal"
)
@service.functionMethod
(
MEMORY_METHODS_NAMESPACE
,
out_signature
=
"
d
"
)
@service.functionMethod
(
MEMORY_METHODS_NAMESPACE
,
out_signature
=
"
i
"
)
def
memoryFree
(
self
)
:
return
self
.
meminfoSum
(
"MemFree"
,
"Buffers"
,
"Cached"
)
@service.functionMethod
(
MEMORY_METHODS_NAMESPACE
,
out_signature
=
"
d
"
)
@service.functionMethod
(
MEMORY_METHODS_NAMESPACE
,
out_signature
=
"
i
"
)
def
swapFull
(
self
)
:
return
self
.
meminfoSum
(
"SwapTotal"
)
@service.functionMethod
(
MEMORY_METHODS_NAMESPACE
,
out_signature
=
"
d
"
)
@service.functionMethod
(
MEMORY_METHODS_NAMESPACE
,
out_signature
=
"
i
"
)
def
swapFree
(
self
)
:
return
self
.
meminfoSum
(
"SwapFree"
,
"SwapCached"
)
...
...
@@ -77,14 +77,14 @@ class Memory(service.FunctionObject) :
meminfo_file
.
close
()
except
:
pass
sum
=
0
.0
sum
=
0
for
meminfo_records_list_item
in
meminfo_records_list
:
value_list
=
re
.
split
(
r"[\s:]+"
,
meminfo_records_list_item
)
if
len
(
value_list
)
!=
3
:
continue
if
value_list
[
0
]
in
args_list
:
sum
+=
floa
t
(
value_list
[
1
])
sum
+=
in
t
(
value_list
[
1
])
return
sum
...
...
@@ -218,7 +218,8 @@ class Service(service.Service) :
shared
.
Functions
.
shared
(
STATISTICS_SHARED_NAME
)
.
addShared
(
CPU_SHARED_NAME
)
stat_file
=
open
(
"/proc/stat"
)
cpu_names_list
=
[
re
.
split
(
r"\s+"
,
stat_record
)[
0
]
for
stat_record
in
stat_file
.
read
()
.
split
(
"
\n
"
)
if
re
.
match
(
r"cpu\d+"
,
stat_record
)
!=
None
]
cpu_names_list
=
[
re
.
split
(
r"\s+"
,
stat_record
)[
0
]
for
stat_record
in
stat_file
.
read
()
.
split
(
"
\n
"
)
if
re
.
match
(
r"cpu\d+"
,
stat_record
)
!=
None
]
try
:
stat_file
.
close
()
except
:
pass
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment