Я написал программное обеспечение на C ++ с целью считывания данных с аппаратного модуля на ПК через карту Gigabit-Ethernet PCIe (которая монтируется на ПК).
Библиотека для этого интерфейса совершенно особенная, поэтому я использовал библиотека, разработанная специалистом JAXA.
Мое программное обеспечение так
/*
* tutorial_RMAPLayer.cc
*
* Created on: Jan 10, 2012
* Author: yuasa
*/
#include "SpaceWireRMAPLibrary/SpaceWire.hh"#include "SpaceWireRMAPLibrary/RMAP.hh"
double readTimeoutDuration = 1000;//1000ms
double writeTimeoutDuration = 1000;//1000ms
int main(int argc, char* argv[]) {
//RMAPInitiator::timelib libcheck;
using namespace std;
/* Open the SpaceWire interface */
cout << "Opening SpaceWireIF...";
SpaceWireIF* spwif = new SpaceWireIFOverIPClient("192.168.1.205", 10030);
try {
spwif->open();
} catch (...) {
cerr << "Connection timed out." << endl;
exit(-1);
}
cout << "done" << endl;
/* Construct and start RMAP Engine */
RMAPEngine* rmapEngine = new RMAPEngine(spwif);
rmapEngine->start();
/* Construct an RMAP Initiator instance */
RMAPInitiator* rmapInitiator = new RMAPInitiator(rmapEngine);
rmapInitiator->setInitiatorLogicalAddress(0xFE);
/////////////////////////////////////////////////////////////////////////////////////
/* Manually sets RMAPTargetNode information */
RMAPTargetNode* rmapTargetNode1 = new RMAPTargetNode();
rmapTargetNode1->setTargetLogicalAddress(0xfe);
rmapTargetNode1->setDefaultKey(0x02);
std::vector<uint8_t> targetSpaceWireAddress;
targetSpaceWireAddress.push_back(0x09);
//targetSpaceWireAddress.push_back(0x0a);
//targetSpaceWireAddress.push_back(0x05);
rmapTargetNode1->setTargetSpaceWireAddress(targetSpaceWireAddress);
std::vector<uint8_t> replyAddress;
replyAddress.push_back(0x01);
//replyAddress.push_back(0x03);
//replyAddress.push_back(0x0f);
rmapTargetNode1->setReplyAddress(replyAddress);
cout << rmapTargetNode1->toString() << endl;
/* RMAP Read/Write with address/length */
try {
uint32_t readLength = atoi(argv[1]);
uint32_t readAddress = 0x2000000;
std::vector<uint8_t> readDataVector(readLength);
cout << "finish declaration" << endl;
rmapInitiator->read(rmapTargetNode1, readAddress, readLength, &(readDataVector.at(0)), readTimeoutDuration);
delete rmapTargetNode1;
cout << "RMAP Read/Write Example1 done" << endl;
} catch (RMAPInitiatorException e) {
cerr << "RMAPInitiatorException " << e.toString() << endl;
cerr << "Continue to next example" << endl;
} catch (RMAPReplyException e) {
cerr << "RMAPReplyException " << e.toString() << endl;
cerr << "Continue to next example" << endl;
} catch (RMAPEngineException e) {
cerr << "RMAPEngineException " << e.toString() << endl;
cerr << "Continue to next example" << endl;
} catch (...) {
cerr << "Unkown error" << endl;
exit(-1);
}
Это программное обеспечение может считывать данные с различным размером пакета путем изменения переменной readLength в коде c ++ (readLength имеет единицу байтов).
Вот моя проблема: 3 дня назад у компьютера возникла проблема, я переустановил Linux (Scientific Linux 6.6). Скорости этого программного обеспечения до и после переустановки очень разные. Подробно, пакет 1000 байтов раньше был 1,6 МБ / с, но теперь он составляет 0,6 МБ / с.
я использовал Трассирование чтобы выяснить проблему, и я обнаружил, что [Futex] вызвал главную проблему. Ниже приведен результат, который я использовал Трассирование. Я обнаружил, что линия futex (8-я строка снизу) вызвала большие издержки моего программного обеспечения (1283 микросекунды!).
execve("./sampleApp", ["./sampleApp", "1000"], [/* 40 vars */]) = 0 <0.000758>
brk(0) = 0x23b2000 <0.000034>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d801000 <0.000038>
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) <0.000066>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/x86_64/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000060>1
stat("/opt/rh/devtoolset-2/root/usr/lib64/tls/x86_64", 0x7ffd3811b500) = -1 ENOENT (No such file or directory) <0.000046>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000048>
stat("/opt/rh/devtoolset-2/root/usr/lib64/tls", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 <0.000047>
open("/opt/rh/devtoolset-2/root/usr/lib64/x86_64/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000046>
stat("/opt/rh/devtoolset-2/root/usr/lib64/x86_64", 0x7ffd3811b500) = -1 ENOENT (No such file or directory) <0.000053>
open("/opt/rh/devtoolset-2/root/usr/lib64/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000053>
stat("/opt/rh/devtoolset-2/root/usr/lib64", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0 <0.000049>
open("/opt/rh/devtoolset-2/root/usr/lib/tls/x86_64/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000053>
stat("/opt/rh/devtoolset-2/root/usr/lib/tls/x86_64", 0x7ffd3811b500) = -1 ENOENT (No such file or directory) <0.000048>
open("/opt/rh/devtoolset-2/root/usr/lib/tls/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000050>
stat("/opt/rh/devtoolset-2/root/usr/lib/tls", 0x7ffd3811b500) = -1 ENOENT (No such file or directory) <0.000049>
open("/opt/rh/devtoolset-2/root/usr/lib/x86_64/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000055>
stat("/opt/rh/devtoolset-2/root/usr/lib/x86_64", 0x7ffd3811b500) = -1 ENOENT (No such file or directory) <0.000050>
open("/opt/rh/devtoolset-2/root/usr/lib/librt.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000052>
stat("/opt/rh/devtoolset-2/root/usr/lib", {st_mode=S_IFDIR|0555, st_size=4096, ...}) = 0 <0.000048>
open("/etc/ld.so.cache", O_RDONLY) = 3 <0.000050>
fstat(3, {st_mode=S_IFREG|0644, st_size=61960, ...}) = 0 <0.000039>
mmap(NULL, 61960, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fd60d7f1000 <0.000043>
close(3) = 0 <0.000030>
open("/lib64/librt.so.1", O_RDONLY) = 3 <0.000055>
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@! \3652\0\0\0"..., 832) = 832 <0.000041>
fstat(3, {st_mode=S_IFREG|0755, st_size=47112, ...}) = 0 <0.000038>
mmap(0x32f5200000, 2128816, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x32f5200000 <0.000043>
mprotect(0x32f5207000, 2093056, PROT_NONE) = 0 <0.000047>
mmap(0x32f5406000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x6000) = 0x32f5406000 <0.000052>
close(3) = 0 <0.000037>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/libxerces-c-3.0.so", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000076>
open("/opt/rh/devtoolset-2/root/usr/lib64/libxerces-c-3.0.so", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000051>
open("/opt/rh/devtoolset-2/root/usr/lib/libxerces-c-3.0.so", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000050>
open("/usr/lib64/libxerces-c-3.0.so", O_RDONLY) = 3 <0.000051>
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\300\251\23\0\0\0\0\0"..., 832) = 832 <0.000040>
fstat(3, {st_mode=S_IFREG|0755, st_size=3803616, ...}) = 0 <0.000038>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d7f0000 <0.000040>
mmap(NULL, 5900296, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x7fd60d24f000 <0.000042>
mprotect(0x7fd60d5b2000, 2093056, PROT_NONE) = 0 <0.000048>
mmap(0x7fd60d7b1000, 258048, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x362000) = 0x7fd60d7b1000 <0.000047>
close(3) = 0 <0.000055>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000099>
open("/opt/rh/devtoolset-2/root/usr/lib64/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000054>
open("/opt/rh/devtoolset-2/root/usr/lib/libpthread.so.0", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000052>
open("/lib64/libpthread.so.0", O_RDONLY) = 3 <0.000054>
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340]\240\3642\0\0\0"..., 832) = 832 <0.000040>
fstat(3, {st_mode=S_IFREG|0755, st_size=145896, ...}) = 0 <0.000042>
mmap(0x32f4a00000, 2212848, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x32f4a00000 <0.000042>
mprotect(0x32f4a17000, 2097152, PROT_NONE) = 0 <0.000061>
mmap(0x32f4c17000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x17000) = 0x32f4c17000 <0.000072>
mmap(0x32f4c19000, 13296, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x32f4c19000 <0.000047>
close(3) = 0 <0.000036>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000106>
open("/opt/rh/devtoolset-2/root/usr/lib64/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000049>
open("/opt/rh/devtoolset-2/root/usr/lib/libstdc++.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000073>
open("/usr/lib64/libstdc++.so.6", O_RDONLY) = 3 <0.000061>
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\360ce\0003\0\0\0"..., 832) = 832 <0.000036>
fstat(3, {st_mode=S_IFREG|0755, st_size=989840, ...}) = 0 <0.000034>
mmap(0x3300600000, 3166648, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3300600000 <0.000039>
mprotect(0x33006e8000, 2097152, PROT_NONE) = 0 <0.000042>
mmap(0x33008e8000, 36864, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0xe8000) = 0x33008e8000 <0.000049>
mmap(0x33008f1000, 82360, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x33008f1000 <0.000060>
close(3) = 0 <0.000040>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000062>
open("/opt/rh/devtoolset-2/root/usr/lib64/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000051>
open("/opt/rh/devtoolset-2/root/usr/lib/libm.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000050>
open("/lib64/libm.so.6", O_RDONLY) = 3 <0.000055>
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p>\240\3652\0\0\0"..., 832) = 832 <0.000040>
fstat(3, {st_mode=S_IFREG|0755, st_size=599392, ...}) = 0 <0.000037>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d24e000 <0.000057>
mmap(0x32f5a00000, 2633912, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x32f5a00000 <0.000057>
mprotect(0x32f5a83000, 2093056, PROT_NONE) = 0 <0.000045>
mmap(0x32f5c82000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x82000) = 0x32f5c82000 <0.000046>
close(3) = 0 <0.000037>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000055>
open("/opt/rh/devtoolset-2/root/usr/lib64/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000051>
open("/opt/rh/devtoolset-2/root/usr/lib/libgcc_s.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000050>
open("/lib64/libgcc_s.so.1", O_RDONLY) = 3 <0.000068>
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20)\240\3772\0\0\0"..., 832) = 832 <0.000039>
fstat(3, {st_mode=S_IFREG|0755, st_size=93320, ...}) = 0 <0.000037>
mmap(0x32ffa00000, 2186584, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x32ffa00000 <0.000043>
mprotect(0x32ffa16000, 2093056, PROT_NONE) = 0 <0.000044>
mmap(0x32ffc15000, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x32ffc15000 <0.000046>
close(3) = 0 <0.000037>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000062>
open("/opt/rh/devtoolset-2/root/usr/lib64/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000049>
open("/opt/rh/devtoolset-2/root/usr/lib/libc.so.6", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000050>
open("/lib64/libc.so.6", O_RDONLY) = 3 <0.000052>
read(3, "\177ELF\2\1\1\3\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p\356a\3642\0\0\0"..., 832) = 832 <0.000039>
fstat(3, {st_mode=S_IFREG|0755, st_size=1926760, ...}) = 0 <0.000038>
mmap(0x32f4600000, 3750152, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x32f4600000 <0.000042>
mprotect(0x32f478a000, 2097152, PROT_NONE) = 0 <0.000048>
mmap(0x32f498a000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x18a000) = 0x32f498a000 <0.000061>
mmap(0x32f498f000, 18696, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x32f498f000 <0.000045>
close(3) = 0 <0.000036>
open("/opt/rh/devtoolset-2/root/usr/lib64/tls/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000055>
open("/opt/rh/devtoolset-2/root/usr/lib64/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000052>
open("/opt/rh/devtoolset-2/root/usr/lib/libnsl.so.1", O_RDONLY) = -1 ENOENT (No such file or directory) <0.000051>
open("/lib64/libnsl.so.1", O_RDONLY) = 3 <0.000053>
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0p@\340\0053\0\0\0"..., 832) = 832 <0.000038>
fstat(3, {st_mode=S_IFREG|0755, st_size=116368, ...}) = 0 <0.000037>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d24d000 <0.000042>
mmap(0x3305e00000, 2198192, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3305e00000 <0.000043>
mprotect(0x3305e16000, 2093056, PROT_NONE) = 0 <0.000043>
mmap(0x3306015000, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x3306015000 <0.000048>
mmap(0x3306017000, 6832, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3306017000 <0.000045>
close(3) = 0 <0.000029>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d24c000 <0.000040>
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d24a000 <0.000038>
arch_prctl(ARCH_SET_FS, 0x7fd60d24a720) = 0 <0.000036>
mprotect(0x3306015000, 4096, PROT_READ) = 0 <0.000045>
mprotect(0x32f498a000, 16384, PROT_READ) = 0 <0.000043>
mprotect(0x32f5c82000, 4096, PROT_READ) = 0 <0.000045>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d249000 <0.000045>
mprotect(0x33008e8000, 28672, PROT_READ) = 0 <0.000048>
mprotect(0x32f4c17000, 4096, PROT_READ) = 0 <0.000046>
mprotect(0x32f5406000, 4096, PROT_READ) = 0 <0.000088>
mprotect(0x32f441f000, 4096, PROT_READ) = 0 <0.000052>
munmap(0x7fd60d7f1000, 61960) = 0 <0.000094>
set_tid_address(0x7fd60d24a9f0) = 12598 <0.000035>
set_robust_list(0x7fd60d24aa00, 24) = 0 <0.000034>
futex(0x7ffd3811bdfc, FUTEX_WAKE_PRIVATE, 1) = 0 <0.000037>
futex(0x7ffd3811bdfc, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, NULL, 7fd60d24a720) = -1 EAGAIN (Resource temporarily unavailable) <0.000036>
rt_sigaction(SIGRTMIN, {0x32f4a05c60, [], SA_RESTORER|SA_SIGINFO, 0x32f4a0f710}, NULL, 8) = 0 <0.000036>
rt_sigaction(SIGRT_1, {0x32f4a05cf0, [], SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x32f4a0f710}, NULL, 8) = 0 <0.000034>
rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0 <0.000035>
getrlimit(RLIMIT_STACK, {rlim_cur=10240*1024, rlim_max=RLIM64_INFINITY}) = 0 <0.000036>
futex(0x33008f1d08, FUTEX_WAKE_PRIVATE, 2147483647) = 0 <0.000045>
fstat(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 2), ...}) = 0 <0.000039>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d800000 <0.000046>
brk(0) = 0x23b2000 <0.000035>
brk(0x23d3000) = 0x23d3000 <0.000039>
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3 <0.000098>
open("/etc/resolv.conf", O_RDONLY) = 4 <0.000066>
fstat(4, {st_mode=S_IFREG|0644, st_size=88, ...}) = 0 <0.000036>
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60d7ff000 <0.000038>
read(4, "# Generated by NetworkManager\nse"..., 4096) = 88 <0.000053>
read(4, "", 4096) = 0 <0.000035>
close(4) = 0 <0.000039>
munmap(0x7fd60d7ff000, 4096) = 0 <0.000065>
fcntl(3, F_GETFL) = 0x2 (flags O_RDWR) <0.000036>
fcntl(3, F_SETFL, O_RDWR|O_NONBLOCK) = 0 <0.000035>
connect(3, {sa_family=AF_INET, sin_port=htons(10030), sin_addr=inet_addr("192.168.1.205")}, 16) = -1 EINPROGRESS (Operation now in progress) <0.000181>
select(4, NULL, [3], NULL, {1, 0}) = 1 (out [3], left {0, 996039}) <0.004019>
getpeername(3, {sa_family=AF_INET, sin_port=htons(10030), sin_addr=inet_addr("192.168.1.205")}, [16]) = 0 <0.000049>
fcntl(3, F_SETFL, O_RDWR) = 0 <0.000043>
setsockopt(3, SOL_SOCKET, SO_RCVTIMEO, "\0\0\0\0\0\0\0\0 \241\7\0\0\0\0\0", 16) = 0 <0.000045>
setsockopt(3, SOL_TCP, TCP_NODELAY, [1], 4) = 0 <0.000044>
mmap(NULL, 10489856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60c848000 <0.000060>
mmap(NULL, 10489856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fd60be47000 <0.000043>
write(1, "Opening SpaceWireIF...done\n", 27) = 27 <0.000060>
brk(0x23f4000) = 0x23f4000 <0.000046>
brk(0x2415000) = 0x2415000 <0.000049>
brk(0x2436000) = 0x2436000 <0.000043>
brk(0x2457000) = 0x2457000 <0.000044>
brk(0x2478000) = 0x2478000 <0.000044>
brk(0x2499000) = 0x2499000 <0.000058>
brk(0x24ba000) = 0x24ba000 <0.000043>
brk(0x24db000) = 0x24db000 <0.000042>
brk(0x24fc000) = 0x24fc000 <0.000043>
brk(0x251d000) = 0x251d000 <0.000044>
brk(0x253e000) = 0x253e000 <0.000044>
brk(0x255f000) = 0x255f000 <0.000043>
brk(0x2580000) = 0x2580000 <0.000044>
brk(0x25a1000) = 0x25a1000 <0.000043>
brk(0x25c2000) = 0x25c2000 <0.000044>
mmap(NULL, 10489856, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_STACK, -1, 0) = 0x7fd60b446000 <0.000052>
mprotect(0x7fd60b446000, 4096, PROT_NONE) = 0 <0.000055>
clone(child_stack=0x7fd60be45fd0, flags=CLONE_VM|CLONE_FS|CLONE_FILES|CLONE_SIGHAND|CLONE_THREAD|CLONE_SYSVSEM|CLONE_SETTLS|CLONE_PARENT_SETTID|CLONE_CHILD_CLEARTID, parent_tidptr=0x7fd60be469d0, tls=0x7fd60be46700, child_tidptr=0x7fd60be469d0) = 12599 <0.000098>
write(1, "ID : \nTar"..., 162) = 162 <0.000085>
write(1, "\n", 1) = 1 <0.000064>
write(1, "finish declaration\n", 19) = 19 <0.000044>
write(1, "rx start\n", 9) = 9 <0.000044>
write(1, "rx set parameters\n", 18) = 18 <0.000045>
sendto(3, "\0\0\0\0\0\0\0\0\0\0\0\25", 12, 0, NULL, 0) = 12 <0.000079>
sendto(3, "\t\376\1M\2\0\0\0\1\376\0\0\0\2\0\0\0\0\3\3506", 21, 0, NULL, 0) = 21 <0.000144>
write(1, "rx initiate TID\n", 16) = 16 <0.000048>
futex(0x25b2cac, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, {1438329719, 587231000}, ffffffff) = 0 <0.001283>
futex(0x25b2c70, FUTEX_WAKE_PRIVATE, 1) = 0 <0.000043>
write(1, "rx receive\n", 11) = 11 <0.000055>
write(1, "rx copy\n", 8) = 8 <0.000041>
write(1, "rx end\n", 7) = 7 <0.000041>
write(1, "RMAP Read/Write Example1 done\n", 30) = 30 <0.000041>
exit_group(0) = ?
+++ exited with 0 +++
Программное обеспечение довольно сложное (по крайней мере для меня), оно состоит из потока генерации, TID, … до процесса чтения. В этом отчете Трассирование вы увидите: почти в конце (около 10 последних строк) есть некоторый кут завершение объявления, начало rx, набор параметров rx, TID инициации rx, получение rx, копия rx, конец rx, который я отмечаю (в программном обеспечении и библиотеке), чтобы знать, где начинается процесс чтения.
Вот линия futex, которую я упомянул
futex(0x25b2cac, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 1, {1438329719, 587231000}, ffffffff) = 0 <0.001283>e
В целом процесс считывания тратит 1500 микросекунд по сравнению со временем считывания до 600 микросекунд (в 2,5 раза больше).
Я также сравнил результат со считыванием данных библиотеки C, библиотека C — 1,8 МБ / с. Таким образом, я думаю, что не ошиблись с драйвером карты Gigabit-Ethernet PCIe.
Я много искал в интернете, но все еще не нашел решения. Как можно уменьшить эти накладные расходы? Или как я могу определить, какая функция в библиотеке вызвала эти издержки futex?
Заранее спасибо.
Я спешу завершить этот шаг.
Таким образом, я действительно очень хочу скорейшего решения ….
РЕДАКТИРОВАТЬ: я делаю еще несколько тестов. Я обнаружил, что с размером пакета <= (меньше или равно) 100 байт, скорость не изменяется по сравнению с предыдущей. Но из 200 байтов это намного медленнее.
Я также думаю о MTU, но настройка для MTU не изменилась (до и после переустановки).
РЕДАКТИРОВАТЬ (2015/08/02): strace сообщает о futex в моем программном обеспечении, но я не могу найти какую-либо команду futex в моей библиотеке.
Задача ещё не решена.