Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
td_spectre
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Térence Chateigné
td_spectre
Commits
1e2fa05c
Commit
1e2fa05c
authored
4 years ago
by
Terence Chateigne
Browse files
Options
Downloads
Patches
Plain Diff
cachetime
parent
49af9571
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cachetime.c
+13
-6
13 additions, 6 deletions
cachetime.c
with
13 additions
and
6 deletions
cachetime.c
+
13
−
6
View file @
1e2fa05c
...
...
@@ -17,23 +17,30 @@ int main(int argc, const char **argv)
array
[
i
*
4096
]
=
1
;
// Vider le tableau du cache
for
(
i
=
0
;
i
<
10
;
i
++
)
{
for
(
i
=
0
;
i
<
10
;
i
++
)
{
// TODO Vidage d'une ligne de cache
_mm_clflush
(
&
array
[
i
*
4096
]);
}
// TODO Accéder à quelques éléments de array
for
(
i
=
5
;
i
<
10
;
i
++
)
{
addr
=
&
array
[
i
*
4096
];
junk
=
*
addr
;
}
// Mesurer les temps d'accès
for
(
i
=
0
;
i
<
10
;
i
++
)
{
addr
=
&
array
[
i
*
4096
];
// TODO prendre le timestamp CPU avant lecture
// TODO prendre le timestamp CPU avant lecture
time1
=
__rdtsc
();
junk
=
*
addr
;
// TODO calculer le temps écoulé dans time2
time2
=
__rdtsc
()
-
time1
;
printf
(
"Temps d'accès à array[%d * 4096]: %ld cycles CPU.
\n
"
,
i
,
time2
);
}
return
0
;
}
\ No newline at end of file
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