Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
LLVM bpEVL
Manage
Activity
Members
Labels
Plan
Issues
0
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
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Albano
LLVM bpEVL
Commits
a3ddb9b5
Commit
a3ddb9b5
authored
22 years ago
by
Chris Lattner
Browse files
Options
Downloads
Patches
Plain Diff
Add facility to compute peak memory usage
llvm-svn: 4752
parent
2a254b6a
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
llvm/include/Support/Timer.h
+11
-0
11 additions, 0 deletions
llvm/include/Support/Timer.h
with
11 additions
and
0 deletions
llvm/include/Support/Timer.h
+
11
−
0
View file @
a3ddb9b5
...
@@ -35,6 +35,8 @@ class Timer {
...
@@ -35,6 +35,8 @@ class Timer {
double
UserTime
;
// User time elapsed
double
UserTime
;
// User time elapsed
double
SystemTime
;
// System time elapsed
double
SystemTime
;
// System time elapsed
long
MemUsed
;
// Memory allocated (in bytes)
long
MemUsed
;
// Memory allocated (in bytes)
long
PeakMem
;
// Peak memory used
long
PeakMemBase
;
// Temporary for peak calculation...
std
::
string
Name
;
// The name of this time variable
std
::
string
Name
;
// The name of this time variable
bool
Started
;
// Has this time variable ever been started?
bool
Started
;
// Has this time variable ever been started?
TimerGroup
*
TG
;
// The TimerGroup this Timer is in.
TimerGroup
*
TG
;
// The TimerGroup this Timer is in.
...
@@ -47,6 +49,7 @@ public:
...
@@ -47,6 +49,7 @@ public:
double
getProcessTime
()
const
{
return
UserTime
+
SystemTime
;
}
double
getProcessTime
()
const
{
return
UserTime
+
SystemTime
;
}
double
getWallTime
()
const
{
return
Elapsed
;
}
double
getWallTime
()
const
{
return
Elapsed
;
}
long
getMemUsed
()
const
{
return
MemUsed
;
}
long
getMemUsed
()
const
{
return
MemUsed
;
}
long
getPeakMem
()
const
{
return
PeakMem
;
}
std
::
string
getName
()
const
{
return
Name
;
}
std
::
string
getName
()
const
{
return
Name
;
}
const
Timer
&
operator
=
(
const
Timer
&
T
)
{
const
Timer
&
operator
=
(
const
Timer
&
T
)
{
...
@@ -54,6 +57,8 @@ public:
...
@@ -54,6 +57,8 @@ public:
UserTime
=
T
.
UserTime
;
UserTime
=
T
.
UserTime
;
SystemTime
=
T
.
SystemTime
;
SystemTime
=
T
.
SystemTime
;
MemUsed
=
T
.
MemUsed
;
MemUsed
=
T
.
MemUsed
;
PeakMem
=
T
.
PeakMem
;
PeakMemBase
=
T
.
PeakMemBase
;
Name
=
T
.
Name
;
Name
=
T
.
Name
;
Started
=
T
.
Started
;
Started
=
T
.
Started
;
assert
(
TG
==
T
.
TG
&&
"Can only assign timers in the same TimerGroup!"
);
assert
(
TG
==
T
.
TG
&&
"Can only assign timers in the same TimerGroup!"
);
...
@@ -77,6 +82,12 @@ public:
...
@@ -77,6 +82,12 @@ public:
///
///
void
stopTimer
();
void
stopTimer
();
/// addPeakMemoryMeasurement - This method should be called whenever memory
/// usage needs to be checked. It adds a peak memory measurement to the
/// currently active timers, which will be printed when the timer group prints
///
static
void
addPeakMemoryMeasurement
();
/// print - Print the current timer to standard error, and reset the "Started"
/// print - Print the current timer to standard error, and reset the "Started"
/// flag.
/// flag.
void
print
(
const
Timer
&
Total
);
void
print
(
const
Timer
&
Total
);
...
...
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