Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Dmitri Naumov
ogs
Commits
0dcb91d6
Commit
0dcb91d6
authored
10 years ago
by
Norihiro Watanabe
Browse files
Options
Downloads
Patches
Plain Diff
make MemWatch class being accessible on any platforms, though it does nothing on Windows and Mac.
parent
1d47d940
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
BaseLib/MemWatch.cpp
+11
-2
11 additions, 2 deletions
BaseLib/MemWatch.cpp
BaseLib/MemWatch.h
+4
-15
4 additions, 15 deletions
BaseLib/MemWatch.h
with
15 additions
and
17 deletions
BaseLib/MemWatch.cpp
+
11
−
2
View file @
0dcb91d6
...
@@ -14,7 +14,14 @@
...
@@ -14,7 +14,14 @@
#include
"MemWatch.h"
#include
"MemWatch.h"
#ifndef _MSC_VER
#if !defined(WIN32) && !defined(__APPLE__)
#include
<iostream>
#include
<fstream>
#include
<string>
#include
<sstream>
#include
<sys/types.h>
#include
<unistd.h>
#endif
namespace
BaseLib
{
namespace
BaseLib
{
...
@@ -25,6 +32,7 @@ MemWatch::MemWatch ()
...
@@ -25,6 +32,7 @@ MemWatch::MemWatch ()
unsigned
MemWatch
::
updateMemUsage
()
unsigned
MemWatch
::
updateMemUsage
()
{
{
#if !defined(WIN32) && !defined(__APPLE__)
std
::
string
fname
(
"/proc/"
);
std
::
string
fname
(
"/proc/"
);
std
::
stringstream
str_pid
;
std
::
stringstream
str_pid
;
str_pid
<<
(
unsigned
)
getpid
();
str_pid
<<
(
unsigned
)
getpid
();
...
@@ -48,6 +56,8 @@ unsigned MemWatch::updateMemUsage ()
...
@@ -48,6 +56,8 @@ unsigned MemWatch::updateMemUsage ()
in
>>
pages
;
in
>>
pages
;
_cmem_size
=
((
unsigned
long
)
pages
)
*
((
unsigned
long
)
getpagesize
());
_cmem_size
=
((
unsigned
long
)
pages
)
*
((
unsigned
long
)
getpagesize
());
in
.
close
();
in
.
close
();
#endif
return
0
;
return
0
;
}
}
...
@@ -74,4 +84,3 @@ unsigned long MemWatch::getCodeMemUsage () {
...
@@ -74,4 +84,3 @@ unsigned long MemWatch::getCodeMemUsage () {
}
// end namespace BaseLib
}
// end namespace BaseLib
#endif // _MSC_VER
This diff is collapsed.
Click to expand it.
BaseLib/MemWatch.h
+
4
−
15
View file @
0dcb91d6
...
@@ -15,15 +15,6 @@
...
@@ -15,15 +15,6 @@
#ifndef MEMWATCH_H_
#ifndef MEMWATCH_H_
#define MEMWATCH_H_
#define MEMWATCH_H_
#ifndef _MSC_VER
#include
<sys/types.h>
#include
<unistd.h>
#include
<iostream>
#include
<fstream>
#include
<string>
#include
<sstream>
namespace
BaseLib
{
namespace
BaseLib
{
class
MemWatch
{
class
MemWatch
{
...
@@ -36,14 +27,12 @@ public:
...
@@ -36,14 +27,12 @@ public:
private:
private:
unsigned
updateMemUsage
();
unsigned
updateMemUsage
();
unsigned
long
_vmem_size
;
unsigned
long
_vmem_size
=
0
;
unsigned
long
_rmem_size
;
unsigned
long
_rmem_size
=
0
;
unsigned
long
_smem_size
;
unsigned
long
_smem_size
=
0
;
unsigned
long
_cmem_size
;
unsigned
long
_cmem_size
=
0
;
};
};
}
}
#endif // not Windows
#endif
/* MEMWATCH_H_ */
#endif
/* MEMWATCH_H_ */
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