From 43996d3ac7c8d79bcfaf56bd3f98b9955c481e9e Mon Sep 17 00:00:00 2001 From: Yevgen Kovalyov Date: Thu, 6 Feb 2020 22:21:57 +0200 Subject: [PATCH 1/7] time management: homework Signed-off-by: Yevgen Kovalyov --- timer/README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 timer/README.md diff --git a/timer/README.md b/timer/README.md new file mode 100644 index 0000000..d7fa872 --- /dev/null +++ b/timer/README.md @@ -0,0 +1,19 @@ +# Internal Kernel API (Time Management) + +## Homework + +1. User space. Implement program which shows absolute time in user space. +Pull request should contain the commit with source code and +generated output in text format. + +2. Kernel space. + a) Implement kernel module with API in sysfs, + which show relation time in maximum possible resolution + passed since previous read of it. + b) Implement kernel module with API in sysfs which shows absolute time of + previous reading with maximum resolution like ‘400.123567’ seconds. + c) (optional) Implement kernel module with API in sysfs which shows + average processor load updated once in a second. +Pull request should contain the commit with source code and +text output from sysfs. + \ No newline at end of file From f4d74804f13883e3d02843139eb2188f36d0de90 Mon Sep 17 00:00:00 2001 From: Yevgen Kovalyov Date: Thu, 6 Feb 2020 22:53:27 +0200 Subject: [PATCH 2/7] memory management: homework Signed-off-by: Yevgen Kovalyov --- memory/README.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 memory/README.md diff --git a/memory/README.md b/memory/README.md new file mode 100644 index 0000000..4c22613 --- /dev/null +++ b/memory/README.md @@ -0,0 +1,22 @@ +# Memory management + +## Homework +1. Create user-space C or C++ program which tries to allocate buffers + with sizes 2^x for x in range from 0 to maximium possible value + using functions: + **malloc, calloc, alloca, (optional for C++) new **. + Measure time of each allocation/freeing. + 2^x means x power of 2 in this task. +Pull request should contains program source code and program output +in text format. + +2. Create kernel module and test allocation/freeing time for functions: + **kmalloc, kzmalloc, vmalloc, get_free_pages, + (optional and only for drivers integrated to kernel)alloc_bootmem**. + Measure the time of each allocation/freeing except alloc_bootmem. + The results should be presented in text file table with followed columns: + Buffer size, allocation time, freeing time. + Size unit is 1 byte, time unit is 1 ns. + +Pull request should contains source code of developed driver, Makefile +and program output from system log in text format. From d96e6f8a8d1a458e7a2ff78d547f1f9fd73c3851 Mon Sep 17 00:00:00 2001 From: Zorin Matvii Date: Fri, 7 Feb 2020 21:09:20 +0200 Subject: [PATCH 3/7] memory: Create user-space program, which measures time of malloc and free Signed-off-by: Zorin Matvii --- memory/log.txt | 2 ++ memory/uapi_memory.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 memory/log.txt create mode 100644 memory/uapi_memory.c diff --git a/memory/log.txt b/memory/log.txt new file mode 100644 index 0000000..23488b6 --- /dev/null +++ b/memory/log.txt @@ -0,0 +1,2 @@ +malloc(1) inter = 72499 ns +free() inter = 192 ns diff --git a/memory/uapi_memory.c b/memory/uapi_memory.c new file mode 100644 index 0000000..0c35bd2 --- /dev/null +++ b/memory/uapi_memory.c @@ -0,0 +1,30 @@ +#include +#include +#include + +long get_interval(struct timespec *ts1, struct timespec *ts2) +{ + return 1000000000 * (ts2->tv_sec - ts1->tv_sec) + + (ts2->tv_nsec - ts1->tv_nsec); +} + +int main(void) +{ + struct timespec ts1, ts2; + void *pdata = NULL; + long inter = 0; + + clock_gettime(CLOCK_REALTIME, &ts1); + pdata = malloc(1); + clock_gettime(CLOCK_REALTIME, &ts2); + inter = get_interval(&ts1, &ts2); + printf("malloc(1) inter = %ld ns\n", inter); + + clock_gettime(CLOCK_REALTIME, &ts1); + free(pdata); + clock_gettime(CLOCK_REALTIME, &ts2); + inter = get_interval(&ts1, &ts2); + printf("free() inter = %ld ns\n", inter); + + return 0; +} From f4dea0f86383beed576d6d554e1efe621406ac0c Mon Sep 17 00:00:00 2001 From: Zorin Matvii Date: Fri, 7 Feb 2020 22:20:56 +0200 Subject: [PATCH 4/7] memory: Add loop to allocate buffers Measure time of functions malloc and free Get average of execution time Signed-off-by: Zorin Matvii --- memory/log.txt | 39 +++++++++++++++++++++++++++++++++++++-- memory/uapi_memory.c | 41 ++++++++++++++++++++++++++++++----------- 2 files changed, 67 insertions(+), 13 deletions(-) diff --git a/memory/log.txt b/memory/log.txt index 23488b6..db28991 100644 --- a/memory/log.txt +++ b/memory/log.txt @@ -1,2 +1,37 @@ -malloc(1) inter = 72499 ns -free() inter = 192 ns +*--------------------------*malloc()*--------------------------* +Power Buffer size (bytes) Allocation (ns) Freeing (ns) +1 1 730 292 +2 2 205 136 +3 4 76 80 +4 8 72 80 +5 16 145 112 +6 32 224 84 +7 64 136 80 +8 128 188 85 +9 256 140 80 +10 512 208 80 +11 1024 273 80 +12 2048 4089 517 +13 4096 176 153 +14 8192 3753 136 +15 16384 3973 96 +16 32768 3749 100 +17 65536 3841 100 +18 131072 9005 12168 +19 262144 5986 5509 +20 524288 5757 5289 +21 1048576 5597 5317 +22 2097152 7625 8596 +23 4194304 7979 6519 +24 8388608 7044 6338 +25 16777216 6945 6286 +26 33554432 6924 6499 +27 67108864 7008 6732 +28 134217728 6980 7438 +29 268435456 6980 8989 +30 536870912 8223 14029 +31 1073741824 11591 29393 +32 2147483648 14683 29701 +33 4294967296 9117 19261 + +MEAN 4527 5465 diff --git a/memory/uapi_memory.c b/memory/uapi_memory.c index 0c35bd2..a1487bb 100644 --- a/memory/uapi_memory.c +++ b/memory/uapi_memory.c @@ -12,19 +12,38 @@ int main(void) { struct timespec ts1, ts2; void *pdata = NULL; - long inter = 0; + long mean_alloc = 0; + long mean_free = 0; + long curr_alloc = 0; + long curr_free = 0; + long inter_count = 0; - clock_gettime(CLOCK_REALTIME, &ts1); - pdata = malloc(1); - clock_gettime(CLOCK_REALTIME, &ts2); - inter = get_interval(&ts1, &ts2); - printf("malloc(1) inter = %ld ns\n", inter); + printf("*--------------------------*malloc()*--------------------------*\n"); + printf("%-8s%-25s%-20s%-20s\n", "Power", "Buffer size (bytes)", "Allocation (ns)", "Freeing (ns)"); + size_t alloc_size = 1; + do { + clock_gettime(CLOCK_REALTIME, &ts1); + pdata = malloc(alloc_size); + clock_gettime(CLOCK_REALTIME, &ts2); - clock_gettime(CLOCK_REALTIME, &ts1); - free(pdata); - clock_gettime(CLOCK_REALTIME, &ts2); - inter = get_interval(&ts1, &ts2); - printf("free() inter = %ld ns\n", inter); + if (!pdata) + break; + curr_alloc = get_interval(&ts1, &ts2); + mean_alloc += curr_alloc; + + clock_gettime(CLOCK_REALTIME, &ts1); + free(pdata); + clock_gettime(CLOCK_REALTIME, &ts2); + + curr_free = get_interval(&ts1, &ts2); + mean_free += curr_free; + ++inter_count; + printf("%-8ld%-25lu%-20ld%-20ld\n", inter_count, alloc_size, curr_alloc, curr_free); + } while(alloc_size *= 2); + + mean_alloc /= inter_count; + mean_free /= inter_count; + printf("\n%-33s%-20ld%-20ld\n", "MEAN", mean_alloc, mean_free); return 0; } From ccce55de2dae78df8d4f1a3e18c9914192af3fe4 Mon Sep 17 00:00:00 2001 From: Zorin Matvii Date: Fri, 7 Feb 2020 23:19:21 +0200 Subject: [PATCH 5/7] memory: Add 3 functions to provide memory allocate functions testing See "Segmentation fault" in alloc_test() function Signed-off-by: Zorin Matvii --- memory/log.txt | 107 +++++++++++++++++++++++++++++-------------- memory/uapi_memory.c | 79 +++++++++++++++++++++++++++++++- 2 files changed, 150 insertions(+), 36 deletions(-) diff --git a/memory/log.txt b/memory/log.txt index db28991..06824aa 100644 --- a/memory/log.txt +++ b/memory/log.txt @@ -1,37 +1,76 @@ + *--------------------------*malloc()*--------------------------* Power Buffer size (bytes) Allocation (ns) Freeing (ns) -1 1 730 292 -2 2 205 136 -3 4 76 80 -4 8 72 80 -5 16 145 112 -6 32 224 84 -7 64 136 80 -8 128 188 85 -9 256 140 80 -10 512 208 80 -11 1024 273 80 -12 2048 4089 517 -13 4096 176 153 -14 8192 3753 136 -15 16384 3973 96 -16 32768 3749 100 -17 65536 3841 100 -18 131072 9005 12168 -19 262144 5986 5509 -20 524288 5757 5289 -21 1048576 5597 5317 -22 2097152 7625 8596 -23 4194304 7979 6519 -24 8388608 7044 6338 -25 16777216 6945 6286 -26 33554432 6924 6499 -27 67108864 7008 6732 -28 134217728 6980 7438 -29 268435456 6980 8989 -30 536870912 8223 14029 -31 1073741824 11591 29393 -32 2147483648 14683 29701 -33 4294967296 9117 19261 +1 1 639 250 +2 2 136 76 +3 4 62 52 +4 8 65 50 +5 16 118 53 +6 32 133 56 +7 64 173 60 +8 128 125 57 +9 256 88 60 +10 512 123 55 +11 1024 161 55 +12 2048 2814 503 +13 4096 136 111 +14 8192 2667 65 +15 16384 2964 68 +16 32768 2709 68 +17 65536 2649 65 +18 131072 7214 11243 +19 262144 4328 3641 +20 524288 3932 3511 +21 1048576 3922 3563 +22 2097152 6590 6440 +23 4194304 6199 4696 +24 8388608 5362 4700 +25 16777216 5014 4485 +26 33554432 5010 4580 +27 67108864 4996 4713 +28 134217728 4969 5114 +29 268435456 4954 8277 +30 536870912 4851 8161 +31 1073741824 5969 12895 +32 2147483648 5312 12504 +33 4294967296 5297 12424 + +MEAN 3020 3413 + +*--------------------------*calloc()*--------------------------* +Power Buffer size (bytes) Allocation (ns) Freeing (ns) +1 1 506 185 +2 2 115 53 +3 4 96 53 +4 8 92 55 +5 16 146 53 +6 32 158 52 +7 64 158 55 +8 128 271 57 +9 256 196 60 +10 512 248 65 +11 1024 225 73 +12 2048 320 225 +13 4096 411 100 +14 8192 3250 73 +15 16384 3569 85 +16 32768 10327 146 +17 65536 25198 160 +18 131072 58739 163 +19 262144 139834 236 +20 524288 39028 190 +21 1048576 346880 186 +22 2097152 508630 300 +23 4194304 1477771 6869 +24 8388608 4135254 734 +25 16777216 5359725 968 +26 33554432 15250 13000 +27 67108864 5334 4553 +28 134217728 4238 4544 +29 268435456 4176 5120 +30 536870912 4059 6818 +31 1073741824 5032 10706 +32 2147483648 4465 10362 +33 4294967296 4402 10506 -MEAN 4527 5465 +MEAN 368427 2327 diff --git a/memory/uapi_memory.c b/memory/uapi_memory.c index a1487bb..c268810 100644 --- a/memory/uapi_memory.c +++ b/memory/uapi_memory.c @@ -8,7 +8,7 @@ long get_interval(struct timespec *ts1, struct timespec *ts2) (ts2->tv_nsec - ts1->tv_nsec); } -int main(void) +static inline void malloc_test(void) { struct timespec ts1, ts2; void *pdata = NULL; @@ -18,7 +18,7 @@ int main(void) long curr_free = 0; long inter_count = 0; - printf("*--------------------------*malloc()*--------------------------*\n"); + printf("\n*--------------------------*malloc()*--------------------------*\n"); printf("%-8s%-25s%-20s%-20s\n", "Power", "Buffer size (bytes)", "Allocation (ns)", "Freeing (ns)"); size_t alloc_size = 1; do { @@ -45,5 +45,80 @@ int main(void) mean_alloc /= inter_count; mean_free /= inter_count; printf("\n%-33s%-20ld%-20ld\n", "MEAN", mean_alloc, mean_free); +} + +static inline void calloc_test(void) +{ + struct timespec ts1, ts2; + void *pdata = NULL; + long mean_alloc = 0; + long mean_free = 0; + long curr_alloc = 0; + long curr_free = 0; + long inter_count = 0; + + printf("\n*--------------------------*calloc()*--------------------------*\n"); + printf("%-8s%-25s%-20s%-20s\n", "Power", "Buffer size (bytes)", "Allocation (ns)", "Freeing (ns)"); + size_t alloc_size = 1; + do { + clock_gettime(CLOCK_REALTIME, &ts1); + pdata = calloc(alloc_size, 1); + clock_gettime(CLOCK_REALTIME, &ts2); + + if (!pdata) + break; + + curr_alloc = get_interval(&ts1, &ts2); + mean_alloc += curr_alloc; + + clock_gettime(CLOCK_REALTIME, &ts1); + free(pdata); + clock_gettime(CLOCK_REALTIME, &ts2); + + curr_free = get_interval(&ts1, &ts2); + mean_free += curr_free; + ++inter_count; + printf("%-8ld%-25lu%-20ld%-20ld\n", inter_count, alloc_size, curr_alloc, curr_free); + } while(alloc_size *= 2); + + mean_alloc /= inter_count; + mean_free /= inter_count; + printf("\n%-33s%-20ld%-20ld\n", "MEAN", mean_alloc, mean_free); +} + +static inline void alloca_test(void) +{ + struct timespec ts1, ts2; + void *pdata = NULL; + long mean_alloc = 0; + long curr_alloc = 0; + long inter_count = 0; + + printf("\n*--------------------------*alloca()*--------------------------*\n"); + printf("%-8s%-25s%-20s\n", "Power", "Buffer size (bytes)", "Allocation (ns)"); + size_t alloc_size = 1; + do { + clock_gettime(CLOCK_REALTIME, &ts1); + pdata = alloca(alloc_size); + clock_gettime(CLOCK_REALTIME, &ts2); + + if (!pdata) + break; + + curr_alloc = get_interval(&ts1, &ts2); + mean_alloc += curr_alloc; + ++inter_count; + printf("%-8ld%-25lu%-20ld\n", inter_count, alloc_size, curr_alloc); + } while(alloc_size *= 2); + + mean_alloc /= inter_count; + printf("\n%-33s%-20ld\n", "MEAN", mean_alloc); +} + +int main(void) +{ + malloc_test(); + calloc_test(); + //alloca_test(); return 0; } From 46da0754e808c78defaaa6b28e41901559401030 Mon Sep 17 00:00:00 2001 From: Zorin Matvii Date: Sat, 8 Feb 2020 13:38:42 +0200 Subject: [PATCH 6/7] memory: Add stack memory control (low) Get standart stack size information via pthread attribute Count free allocation space using the appropriate coefficient (wontfix) Fix output of buffer size power (change the increment moment) Signed-off-by: Zorin Matvii --- memory/log.txt | 163 +++++++++++++++++++++++++------------------ memory/uapi_memory.c | 36 +++++++--- 2 files changed, 121 insertions(+), 78 deletions(-) diff --git a/memory/log.txt b/memory/log.txt index 06824aa..bd0226d 100644 --- a/memory/log.txt +++ b/memory/log.txt @@ -1,76 +1,103 @@ *--------------------------*malloc()*--------------------------* Power Buffer size (bytes) Allocation (ns) Freeing (ns) -1 1 639 250 -2 2 136 76 -3 4 62 52 -4 8 65 50 -5 16 118 53 -6 32 133 56 -7 64 173 60 -8 128 125 57 -9 256 88 60 -10 512 123 55 -11 1024 161 55 -12 2048 2814 503 -13 4096 136 111 -14 8192 2667 65 -15 16384 2964 68 -16 32768 2709 68 -17 65536 2649 65 -18 131072 7214 11243 -19 262144 4328 3641 -20 524288 3932 3511 -21 1048576 3922 3563 -22 2097152 6590 6440 -23 4194304 6199 4696 -24 8388608 5362 4700 -25 16777216 5014 4485 -26 33554432 5010 4580 -27 67108864 4996 4713 -28 134217728 4969 5114 -29 268435456 4954 8277 -30 536870912 4851 8161 -31 1073741824 5969 12895 -32 2147483648 5312 12504 -33 4294967296 5297 12424 +0 1 562 188 +1 2 126 142 +2 4 87 92 +3 8 62 66 +4 16 114 80 +5 32 201 100 +6 64 180 100 +7 128 216 99 +8 256 161 82 +9 512 182 94 +10 1024 257 98 +11 2048 3071 427 +12 4096 202 144 +13 8192 2991 118 +14 16384 2922 130 +15 32768 2956 127 +16 65536 3157 115 +17 131072 7894 11804 +18 262144 6035 5208 +19 524288 4953 4626 +20 1048576 4590 4788 +21 2097152 7491 7109 +22 4194304 7855 6362 +23 8388608 6855 6457 +24 16777216 7230 4132 +25 33554432 4343 3841 +26 67108864 4183 4081 +27 134217728 4370 4466 +28 268435456 4272 5380 +29 536870912 6116 11445 +30 1073741824 7452 17836 +31 2147483648 8581 18082 +32 4294967296 7534 17259 -MEAN 3020 3413 +MEAN 3551 4093 *--------------------------*calloc()*--------------------------* Power Buffer size (bytes) Allocation (ns) Freeing (ns) -1 1 506 185 -2 2 115 53 -3 4 96 53 -4 8 92 55 -5 16 146 53 -6 32 158 52 -7 64 158 55 -8 128 271 57 -9 256 196 60 -10 512 248 65 -11 1024 225 73 -12 2048 320 225 -13 4096 411 100 -14 8192 3250 73 -15 16384 3569 85 -16 32768 10327 146 -17 65536 25198 160 -18 131072 58739 163 -19 262144 139834 236 -20 524288 39028 190 -21 1048576 346880 186 -22 2097152 508630 300 -23 4194304 1477771 6869 -24 8388608 4135254 734 -25 16777216 5359725 968 -26 33554432 15250 13000 -27 67108864 5334 4553 -28 134217728 4238 4544 -29 268435456 4176 5120 -30 536870912 4059 6818 -31 1073741824 5032 10706 -32 2147483648 4465 10362 -33 4294967296 4402 10506 +0 1 473 163 +1 2 200 115 +2 4 164 105 +3 8 122 80 +4 16 170 78 +5 32 172 87 +6 64 200 100 +7 128 385 70 +8 256 248 82 +9 512 317 102 +10 1024 381 96 +11 2048 343 341 +12 4096 785 112 +13 8192 4993 152 +14 16384 3966 112 +15 32768 11941 136 +16 65536 26086 204 +17 131072 69981 187 +18 262144 150670 423 +19 524288 53354 1525 +20 1048576 866863 2804 +21 2097152 899034 483 +22 4194304 1189385 1004 +23 8388608 2389343 839 +24 16777216 5158120 1421 +25 33554432 26193 17083 +26 67108864 10045 9273 +27 134217728 8189 10461 +28 268435456 8123 9737 +29 536870912 7246 12217 +30 1073741824 9096 20275 +31 2147483648 9524 19847 +32 4294967296 8271 19839 -MEAN 368427 2327 +MEAN 330738 3925 + +*--------------------------*alloca()*--------------------------* +Power Buffer size (bytes) Allocation (ns) +0 1 108 +1 2 115 +2 4 92 +3 8 80 +4 16 103 +5 32 85 +6 64 90 +7 128 96 +8 256 98 +9 512 95 +10 1024 80 +11 2048 95 +12 4096 4182 +13 8192 3719 +14 16384 3736 +15 32768 3407 +16 65536 5579 +17 131072 4074 +18 262144 4447 +19 524288 5853 +20 1048576 4167 +21 2097152 5172 + +MEAN 2066 diff --git a/memory/uapi_memory.c b/memory/uapi_memory.c index c268810..857169e 100644 --- a/memory/uapi_memory.c +++ b/memory/uapi_memory.c @@ -1,6 +1,9 @@ #include #include #include +#include + +#define ALLOC_COEF .9F //For controling the stack memory allocation long get_interval(struct timespec *ts1, struct timespec *ts2) { @@ -11,7 +14,7 @@ long get_interval(struct timespec *ts1, struct timespec *ts2) static inline void malloc_test(void) { struct timespec ts1, ts2; - void *pdata = NULL; + void *restrict pdata = NULL; long mean_alloc = 0; long mean_free = 0; long curr_alloc = 0; @@ -38,8 +41,10 @@ static inline void malloc_test(void) curr_free = get_interval(&ts1, &ts2); mean_free += curr_free; - ++inter_count; + printf("%-8ld%-25lu%-20ld%-20ld\n", inter_count, alloc_size, curr_alloc, curr_free); + + ++inter_count; } while(alloc_size *= 2); mean_alloc /= inter_count; @@ -50,7 +55,7 @@ static inline void malloc_test(void) static inline void calloc_test(void) { struct timespec ts1, ts2; - void *pdata = NULL; + void *restrict pdata = NULL; long mean_alloc = 0; long mean_free = 0; long curr_alloc = 0; @@ -77,8 +82,10 @@ static inline void calloc_test(void) curr_free = get_interval(&ts1, &ts2); mean_free += curr_free; - ++inter_count; + printf("%-8ld%-25lu%-20ld%-20ld\n", inter_count, alloc_size, curr_alloc, curr_free); + + ++inter_count; } while(alloc_size *= 2); mean_alloc /= inter_count; @@ -89,26 +96,35 @@ static inline void calloc_test(void) static inline void alloca_test(void) { struct timespec ts1, ts2; - void *pdata = NULL; + void *restrict pdata = NULL; long mean_alloc = 0; long curr_alloc = 0; long inter_count = 0; + ssize_t stack_rem = 0; + pthread_attr_t pth_attr; + + pthread_attr_init(&pth_attr); + pthread_attr_getstacksize(&pth_attr, &stack_rem); + stack_rem *= ALLOC_COEF; printf("\n*--------------------------*alloca()*--------------------------*\n"); printf("%-8s%-25s%-20s\n", "Power", "Buffer size (bytes)", "Allocation (ns)"); size_t alloc_size = 1; do { + stack_rem -= alloc_size; + if (stack_rem < 0) + break; + clock_gettime(CLOCK_REALTIME, &ts1); pdata = alloca(alloc_size); clock_gettime(CLOCK_REALTIME, &ts2); - if (!pdata) - break; - curr_alloc = get_interval(&ts1, &ts2); mean_alloc += curr_alloc; - ++inter_count; + printf("%-8ld%-25lu%-20ld\n", inter_count, alloc_size, curr_alloc); + + ++inter_count; } while(alloc_size *= 2); mean_alloc /= inter_count; @@ -119,6 +135,6 @@ int main(void) { malloc_test(); calloc_test(); - //alloca_test(); + alloca_test(); return 0; } From 56c414e180f69a6741e03ab17f228f34aa72285d Mon Sep 17 00:00:00 2001 From: Zorin Matvii Date: Mon, 10 Feb 2020 15:41:09 +0200 Subject: [PATCH 7/7] memory: Change log file name to avoid the conflict Signed-off-by: Zorin Matvii --- memory/log.txt | 103 -------------------------------------------- memory/uapi_log.txt | 103 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 103 deletions(-) delete mode 100644 memory/log.txt create mode 100644 memory/uapi_log.txt diff --git a/memory/log.txt b/memory/log.txt deleted file mode 100644 index bd0226d..0000000 --- a/memory/log.txt +++ /dev/null @@ -1,103 +0,0 @@ - -*--------------------------*malloc()*--------------------------* -Power Buffer size (bytes) Allocation (ns) Freeing (ns) -0 1 562 188 -1 2 126 142 -2 4 87 92 -3 8 62 66 -4 16 114 80 -5 32 201 100 -6 64 180 100 -7 128 216 99 -8 256 161 82 -9 512 182 94 -10 1024 257 98 -11 2048 3071 427 -12 4096 202 144 -13 8192 2991 118 -14 16384 2922 130 -15 32768 2956 127 -16 65536 3157 115 -17 131072 7894 11804 -18 262144 6035 5208 -19 524288 4953 4626 -20 1048576 4590 4788 -21 2097152 7491 7109 -22 4194304 7855 6362 -23 8388608 6855 6457 -24 16777216 7230 4132 -25 33554432 4343 3841 -26 67108864 4183 4081 -27 134217728 4370 4466 -28 268435456 4272 5380 -29 536870912 6116 11445 -30 1073741824 7452 17836 -31 2147483648 8581 18082 -32 4294967296 7534 17259 - -MEAN 3551 4093 - -*--------------------------*calloc()*--------------------------* -Power Buffer size (bytes) Allocation (ns) Freeing (ns) -0 1 473 163 -1 2 200 115 -2 4 164 105 -3 8 122 80 -4 16 170 78 -5 32 172 87 -6 64 200 100 -7 128 385 70 -8 256 248 82 -9 512 317 102 -10 1024 381 96 -11 2048 343 341 -12 4096 785 112 -13 8192 4993 152 -14 16384 3966 112 -15 32768 11941 136 -16 65536 26086 204 -17 131072 69981 187 -18 262144 150670 423 -19 524288 53354 1525 -20 1048576 866863 2804 -21 2097152 899034 483 -22 4194304 1189385 1004 -23 8388608 2389343 839 -24 16777216 5158120 1421 -25 33554432 26193 17083 -26 67108864 10045 9273 -27 134217728 8189 10461 -28 268435456 8123 9737 -29 536870912 7246 12217 -30 1073741824 9096 20275 -31 2147483648 9524 19847 -32 4294967296 8271 19839 - -MEAN 330738 3925 - -*--------------------------*alloca()*--------------------------* -Power Buffer size (bytes) Allocation (ns) -0 1 108 -1 2 115 -2 4 92 -3 8 80 -4 16 103 -5 32 85 -6 64 90 -7 128 96 -8 256 98 -9 512 95 -10 1024 80 -11 2048 95 -12 4096 4182 -13 8192 3719 -14 16384 3736 -15 32768 3407 -16 65536 5579 -17 131072 4074 -18 262144 4447 -19 524288 5853 -20 1048576 4167 -21 2097152 5172 - -MEAN 2066 diff --git a/memory/uapi_log.txt b/memory/uapi_log.txt new file mode 100644 index 0000000..e03f483 --- /dev/null +++ b/memory/uapi_log.txt @@ -0,0 +1,103 @@ + +*--------------------------*malloc()*--------------------------* +Power Buffer size (bytes) Allocation (ns) Freeing (ns) +0 1 649 223 +1 2 110 120 +2 4 53 58 +3 8 52 82 +4 16 108 58 +5 32 183 57 +6 64 101 58 +7 128 143 58 +8 256 100 57 +9 512 146 55 +10 1024 206 58 +11 2048 2970 431 +12 4096 160 100 +13 8192 2826 68 +14 16384 2754 68 +15 32768 2724 68 +16 65536 2852 67 +17 131072 6841 8657 +18 262144 4490 3839 +19 524288 4180 3779 +20 1048576 4142 4555 +21 2097152 6224 6032 +22 4194304 6688 4598 +23 8388608 5313 4679 +24 16777216 5107 4498 +25 33554432 5370 4641 +26 67108864 6076 5578 +27 134217728 5591 5623 +28 268435456 5488 6688 +29 536870912 5458 8778 +30 1073741824 5500 13123 +31 2147483648 5468 13146 +32 4294967296 5468 13356 + +MEAN 3137 3432 + +*--------------------------*calloc()*--------------------------* +Power Buffer size (bytes) Allocation (ns) Freeing (ns) +0 1 509 183 +1 2 173 83 +2 4 98 60 +3 8 98 57 +4 16 160 58 +5 32 163 58 +6 64 161 55 +7 128 311 63 +8 256 3869 67 +9 512 221 65 +10 1024 276 65 +11 2048 263 243 +12 4096 441 115 +13 8192 3664 133 +14 16384 3736 75 +15 32768 10795 100 +16 65536 25071 108 +17 131072 63415 193 +18 262144 156469 248 +19 524288 47117 238 +20 1048576 398067 323 +21 2097152 498210 121 +22 4194304 1010692 193 +23 8388608 2510674 1403 +24 16777216 6655518 880 +25 33554432 16141 14827 +26 67108864 5996 4857 +27 134217728 4162 4464 +28 268435456 4043 4852 +29 536870912 4058 6525 +30 1073741824 4071 9636 +31 2147483648 4052 9662 +32 4294967296 4147 9730 + +MEAN 346570 2113 + +*--------------------------*alloca()*--------------------------* +Power Buffer size (bytes) Allocation (ns) +0 1 80 +1 2 54 +2 4 54 +3 8 54 +4 16 54 +5 32 56 +6 64 54 +7 128 54 +8 256 54 +9 512 56 +10 1024 54 +11 2048 52 +12 4096 2646 +13 8192 2107 +14 16384 3320 +15 32768 2153 +16 65536 3300 +17 131072 2331 +18 262144 2336 +19 524288 2285 +20 1048576 3049 +21 2097152 2777 + +MEAN 1226