Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Christopher Rob Jones
Gaudi
Commits
924744e4
Commit
924744e4
authored
2 years ago
by
Christopher Rob Jones
Browse files
Options
Downloads
Patches
Plain Diff
ProcStats: remove data members that do not need caching
parent
90b30380
No related branches found
No related tags found
No related merge requests found
Pipeline
#4993781
failed
2 years ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiAud/src/ProcStats.cpp
+10
-9
10 additions, 9 deletions
GaudiAud/src/ProcStats.cpp
GaudiAud/src/ProcStats.h
+1
-2
1 addition, 2 deletions
GaudiAud/src/ProcStats.h
with
11 additions
and
11 deletions
GaudiAud/src/ProcStats.cpp
+
10
−
9
View file @
924744e4
...
...
@@ -251,11 +251,11 @@ ProcStats::ProcStats() {
#if defined( __linux__ ) or defined( __APPLE__ )
m_pg_size
=
sysconf
(
_SC_PAGESIZE
);
// getpagesize();
m_
fname
=
"/proc/"
+
std
::
to_string
(
getpid
()
)
+
"/stat"
;
const
auto
fname
=
"/proc/"
+
std
::
to_string
(
getpid
()
)
+
"/stat"
;
m_ufd
.
open
(
m_
fname
.
c_str
(),
O_RDONLY
);
m_ufd
.
open
(
fname
.
c_str
(),
O_RDONLY
);
if
(
!
m_ufd
)
{
cerr
<<
"Failed to open "
<<
m_
fname
<<
endl
;
cerr
<<
"Failed to open "
<<
fname
<<
endl
;
return
;
}
#endif // __linux__ or __APPLE__
...
...
@@ -267,23 +267,24 @@ bool ProcStats::fetch( procInfo& f ) {
#if defined( __linux__ ) or defined( __APPLE__ )
std
::
scoped_lock
lock
{
m_mutex
};
std
::
scoped_lock
lock
{
m_mutex
};
double
pr_size
{
0
},
pr_rssize
{
0
};
double
pr_size
{
0
},
pr_rssize
{
0
};
linux_proc
pinfo
;
int
cnt
{
0
};
int
cnt
{
0
};
char
buf
[
500
];
m_ufd
.
lseek
(
0
,
SEEK_SET
);
if
(
(
cnt
=
m_ufd
.
read
(
m_
buf
,
sizeof
(
m_
buf
)
)
)
<
0
)
{
if
(
(
cnt
=
m_ufd
.
read
(
buf
,
sizeof
(
buf
)
)
)
<
0
)
{
cout
<<
"LINUX Read of Proc file failed:"
<<
endl
;
return
false
;
}
if
(
cnt
>
0
)
{
m_
buf
[
std
::
min
(
static_cast
<
std
::
size_t
>
(
cnt
),
sizeof
(
m_
buf
)
-
1
)]
=
'\0'
;
buf
[
std
::
min
(
static_cast
<
std
::
size_t
>
(
cnt
),
sizeof
(
buf
)
-
1
)]
=
'\0'
;
sscanf
(
m_
buf
,
sscanf
(
buf
,
// 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 20 1 2 3 4 5 6 7 8 9
// 30 1 2 3 4 5
"%d %s %c %d %d %d %d %d %lu %lu %lu %lu %lu %lu %lu %ld %ld %ld %ld %ld %ld %llu %lu %ld %lu %lu %lu %lu "
...
...
This diff is collapsed.
Click to expand it.
GaudiAud/src/ProcStats.h
+
1
−
2
View file @
924744e4
...
...
@@ -107,11 +107,10 @@ private:
#undef unique_fd_forward
};
private
:
unique_fd
m_ufd
;
double
m_pg_size
{
0
};
procInfo
m_curr
;
std
::
string
m_fname
;
char
m_buf
[
500
];
bool
m_valid
{
false
};
std
::
mutex
m_mutex
;
};
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