Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
swiftshader
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
swiftshader
Commits
a3984a12
Commit
a3984a12
authored
Apr 01, 2016
by
John Porto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Subzero. Outputs liveness memory usage.
BUG= R=stichnot@chromium.org Review URL:
https://codereview.chromium.org/1850163003
.
parent
7bb9cab3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
14 deletions
+28
-14
IceCfg.cpp
src/IceCfg.cpp
+13
-6
IceCfg.h
src/IceCfg.h
+5
-3
IceGlobalContext.cpp
src/IceGlobalContext.cpp
+10
-5
No files found.
src/IceCfg.cpp
View file @
a3984a12
...
...
@@ -1086,12 +1086,19 @@ void Cfg::emitIAS() {
emitJumpTables
();
}
size_t
Cfg
::
getTotalMemoryMB
()
{
constexpr
size_t
OneMB
=
1024
*
1024
;
using
ArbitraryType
=
int
;
// CfgLocalAllocator draws from the same memory pool regardless of allocated
// object type, so pick an arbitrary type for the template parameter.
return
CfgLocalAllocator
<
ArbitraryType
>
().
current
()
->
getTotalMemory
()
/
OneMB
;
size_t
Cfg
::
getTotalMemoryMB
()
const
{
constexpr
size_t
_1MB
=
1024
*
1024
;
assert
(
Allocator
!=
nullptr
);
assert
(
CfgAllocatorTraits
::
current
()
==
Allocator
.
get
());
return
Allocator
->
getTotalMemory
()
/
_1MB
;
}
size_t
Cfg
::
getLivenessMemoryMB
()
const
{
constexpr
size_t
_1MB
=
1024
*
1024
;
if
(
Live
==
nullptr
)
{
return
0
;
}
return
Live
->
getAllocator
()
->
getTotalMemory
()
/
_1MB
;
}
// Dumps the IR with an optional introductory message.
...
...
src/IceCfg.h
View file @
a3984a12
...
...
@@ -226,9 +226,11 @@ public:
const
CfgNode
*
getCurrentNode
()
const
{
return
CurrentNode
;
}
/// @}
/// Get the total amount of memory held by the per-Cfg allocator. This is
/// mostly meant for use inside a debugger.
static
size_t
getTotalMemoryMB
();
/// Get the total amount of memory held by the per-Cfg allocator.
size_t
getTotalMemoryMB
()
const
;
/// Get the current memory usage due to liveness data structures.
size_t
getLivenessMemoryMB
()
const
;
void
emit
();
void
emitIAS
();
...
...
src/IceGlobalContext.cpp
View file @
a3984a12
...
...
@@ -258,11 +258,14 @@ void GlobalContext::CodeStats::dump(const Cfg *Func, GlobalContext *Ctx) {
#undef X
Str
<<
"|"
<<
Name
<<
"|Spills+Fills|"
<<
Stats
[
CS_NumSpills
]
+
Stats
[
CS_NumFills
]
<<
"
\n
"
;
Str
<<
"|"
<<
Name
<<
"|Memory Usage|"
;
if
(
ssize_t
MemUsed
=
llvm
::
TimeRecord
::
getCurrentTime
(
false
).
getMemUsed
())
Str
<<
MemUsed
;
else
Str
<<
"|"
<<
Name
<<
"|Memory Usage |"
;
if
(
const
auto
MemUsed
=
static_cast
<
size_t
>
(
llvm
::
TimeRecord
::
getCurrentTime
(
false
).
getMemUsed
()))
{
static
constexpr
size_t
_1MB
=
1024
*
1024
;
Str
<<
(
MemUsed
/
_1MB
)
<<
" MB"
;
}
else
{
Str
<<
"(requires '-track-memory')"
;
}
Str
<<
"
\n
"
;
Str
<<
"|"
<<
Name
<<
"|CPool Sizes "
;
{
...
...
@@ -279,7 +282,9 @@ void GlobalContext::CodeStats::dump(const Cfg *Func, GlobalContext *Ctx) {
}
Str
<<
"
\n
"
;
if
(
Func
!=
nullptr
)
{
Str
<<
"|"
<<
Name
<<
"|Cfg Memory |"
<<
Func
->
getTotalMemoryMB
()
Str
<<
"|"
<<
Name
<<
"|Cfg Memory |"
<<
Func
->
getTotalMemoryMB
()
<<
" MB
\n
"
;
Str
<<
"|"
<<
Name
<<
"|Liveness Memory |"
<<
Func
->
getLivenessMemoryMB
()
<<
" MB
\n
"
;
}
}
...
...
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