Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
substrate
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
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
Denis_P
substrate
Commits
5f0d4df3
"README.md" did not exist on "0b655477cf9d9ef10d4c42685d61e3714d0ca4cc"
Unverified
Commit
5f0d4df3
authored
6 years ago
by
Michael Müller
Browse files
Options
Downloads
Patches
Plain Diff
Revert me: Add shallow benchmark for a first impression
parent
a114df7d
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/executor/src/heap.rs
+11
-0
11 additions, 0 deletions
core/executor/src/heap.rs
with
11 additions
and
0 deletions
core/executor/src/heap.rs
+
11
−
0
View file @
5f0d4df3
...
...
@@ -19,6 +19,7 @@
use
log
::
trace
;
use
std
::
collections
::
HashMap
;
use
std
::
time
::{
Duration
,
Instant
};
// The pointers need to be aligned to 8 bytes.
const
ALIGNMENT
:
usize
=
8
;
...
...
@@ -38,6 +39,7 @@ pub struct Heap {
heap
:
Vec
<
u8
>
,
max_heap_size
:
usize
,
ptr_offset
:
usize
,
start
:
Instant
,
total_size
:
usize
,
}
...
...
@@ -56,6 +58,7 @@ impl Heap {
/// allocating memory.
///
pub
fn
new
(
mut
ptr_offset
:
usize
,
heap_size
:
usize
)
->
Self
{
eprintln!
(
"Creating heap"
);
let
padding
=
ptr_offset
%
ALIGNMENT
;
if
padding
!=
0
{
ptr_offset
+=
ALIGNMENT
-
padding
;
...
...
@@ -68,6 +71,7 @@ impl Heap {
heap
:
vec!
[
0
;
heap_size
],
max_heap_size
:
heap_size
,
ptr_offset
,
start
:
Instant
::
now
(),
total_size
:
0
,
}
}
...
...
@@ -155,6 +159,13 @@ impl Heap {
}
impl
Drop
for
Heap
{
fn
drop
(
&
mut
self
)
{
let
duration
=
self
.start
.elapsed
();
eprintln!
(
"Dropping heap after {:?}"
,
duration
);
}
}
#[cfg(test)]
mod
tests
{
use
super
::
*
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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