如下基于8K的内存快执行memcpy, 1个线程大约1S能够拷贝500M,如果服务器带宽或网卡到上限是1G,那么网络io的work thread 开2个即可,考虑到消息的解析损耗,3个线程足以抗住硬件的最高负载。 在我到测试机器上到测试结果是: Intel(R) Xeon(R) CPU E5405 @ 2.00GHz do memcpy speed:12.27 ms/MB each thread can...
22gettimeofday(&end, NULL); 23cout <<"do memcpy speed:"<< ((end.tv_sec - start.tv_sec)*1000+double(end.tv_usec - start.tv_usec) / (len*loop/1000/1000) ) / loop<<"ms/MB\n"; 24cout <<"each thread can do memcpy"<<double(len)*loop/1000/1000/ ((end.tv_sec - start.tv...
如下基于8K的内存快执行memcpy, 1个线程大约1S能够拷贝500M,如果服务器带宽或网卡到上限是1G,那么网络io的work thread 开2个即可,考虑到消息的解析损耗,3个线程足以抗住硬件的最高负载。 在我到测试机器上到测试结果是: Intel(R) Xeon(R) CPU E5405 @ 2.00GHz do memcpy speed:12.27 ms/MB each thread can...
gettimeofday(&end, NULL); cout <<"do memcpy speed:" << ((end.tv_sec - start.tv_sec)*1000 + double(end.tv_usec - start.tv_usec) / (len*loop/1000/1000) ) / loop<<" ms/MB\n"; cout <<"each thread can do memcpy "<< double(len)*loop/1000/1000 / ((end.tv_sec - start...
typedefvoid*(*memcpy_t)(void*,void*, size_t);voidmemcpy_speed_test(memcpy_t __memcpy,void*b1,void*b2) {intspeed; unsignedlongnow, j;inti, count, max; preempt_disable(); max=0;for(i =0; i <5; i++) { j=jiffies; count=0;while((now = jiffies) ==j) ...
memcpy speed Sep 5, 2010 at 6:46pm yman(11) Hi. I wonder what is faster - copying a long memory or rather more pieces of short data. Imagine two long arrays of chars (hundreds thousand), which should contain the same data. Now I change only some blocks (lets say tens blocks of ...
...如下基于8K的内存快执行memcpy, 1个线程大约1S能够拷贝500M,如果服务器带宽或网卡到上限是1G,那么网络io的work thread 开2个即可,考虑到消息的解析损耗,3个线程足以抗住硬件的最高负载...在我到测试机器上到测试结果是: Intel(R) Xeon(R) CPU E5405 @ 2.00GHz do memcpy speed:12.27 ms/MB each ...
// gcc -O3 -march=native -std=c99 -o memcpyspeed memcpyspeed.c#include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h>void i386_cpuid_caches () { int i; for (i = 0; i < 32; i++) {// Variables to hold the contents of the ...
// gcc -O3 -march=native -std=c99 -o memcpyspeed memcpyspeed.c #define _POSIX_C_SOURCE (200112L) #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> void i386_cpuid_caches () { int i; for (i = 0; i < 32; i++) { ...
typedef int word; /* "word" used for optimal copy speed */ #define wsize sizeof(word) #define wmask (wsize - 1) /* * Copy a block of memory, handling overlap. * This is the routine that actually implements * (the portable versions of) bcopy, memcpy, and memmove. ...