Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • huruiqi/td_spectre
  • tchateig/td_spectre
  • SR07/td_spectre
3 results
Show changes
Commits on Source (1)
......@@ -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