Small test program timing our path resolution. Which sucks badly...
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27364 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -18,6 +18,8 @@ SimpleTest lock_node_test :
|
||||
|
||||
SimpleTest page_fault_cache_merge_test : page_fault_cache_merge_test.cpp ;
|
||||
|
||||
SimpleTest path_resolution_test : path_resolution_test.cpp ;
|
||||
|
||||
SimpleTest port_close_test_1 : port_close_test_1.cpp ;
|
||||
SimpleTest port_close_test_2 : port_close_test_2.cpp ;
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* Copyright 2008, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
static void
|
||||
time_lstat(const char* path)
|
||||
{
|
||||
printf("%-60s ...", path);
|
||||
fflush(stdout);
|
||||
bigtime_t startTime = system_time();
|
||||
|
||||
static const int32 iterations = 10000;
|
||||
for (int32 i = 0; i < iterations; i++) {
|
||||
struct stat st;
|
||||
lstat(path, &st);
|
||||
}
|
||||
|
||||
bigtime_t totalTime = system_time() - startTime;
|
||||
printf(" %5.3f us/call\n", (double)totalTime / iterations);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main()
|
||||
{
|
||||
const char* const paths[] = {
|
||||
"/",
|
||||
"/boot",
|
||||
"/boot/develop",
|
||||
"/boot/develop/headers",
|
||||
"/boot/develop/headers/posix",
|
||||
"/boot/develop/headers/posix/sys",
|
||||
"/boot/develop/headers/posix/sys/stat.h",
|
||||
NULL
|
||||
};
|
||||
|
||||
for (int32 i = 0; paths[i] != NULL; i++)
|
||||
time_lstat(paths[i]);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user