mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-07 16:49:54 +00:00
Utilities: Use ElapsedTimer::start_new in allocate
This commit is contained in:
parent
74ee7cabf2
commit
5df74c99ab
Notes:
sideshowbarker
2024-07-18 04:07:03 +09:00
Author: https://github.com/bgianfo
Commit: 5df74c99ab
Pull-request: https://github.com/SerenityOS/serenity/pull/9999
Reviewed-by: https://github.com/awesomekling ✅
1 changed files with 2 additions and 6 deletions
|
@ -57,10 +57,8 @@ int main(int argc, char** argv)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
Core::ElapsedTimer timer;
|
|
||||||
|
|
||||||
outln("allocating memory ({} bytes)...", count);
|
outln("allocating memory ({} bytes)...", count);
|
||||||
timer.start();
|
auto timer = Core::ElapsedTimer::start_new();
|
||||||
char* ptr = (char*)malloc(count);
|
char* ptr = (char*)malloc(count);
|
||||||
if (!ptr) {
|
if (!ptr) {
|
||||||
outln("failed.");
|
outln("failed.");
|
||||||
|
@ -71,11 +69,9 @@ int main(int argc, char** argv)
|
||||||
auto pages = count / PAGE_SIZE;
|
auto pages = count / PAGE_SIZE;
|
||||||
auto step = pages / 10;
|
auto step = pages / 10;
|
||||||
|
|
||||||
Core::ElapsedTimer timer2;
|
|
||||||
|
|
||||||
outln("writing one byte to each page of allocated memory...");
|
outln("writing one byte to each page of allocated memory...");
|
||||||
timer.start();
|
timer.start();
|
||||||
timer2.start();
|
auto timer2 = Core::ElapsedTimer::start_new();
|
||||||
for (int i = 0; i < pages; ++i) {
|
for (int i = 0; i < pages; ++i) {
|
||||||
ptr[i * PAGE_SIZE] = 1;
|
ptr[i * PAGE_SIZE] = 1;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue