我目前有一个 python 程序,它(非常缓慢)通过递归调用从 Red Pitaya 板上接收数据:
redpitaya_scpi.scpi(192.169.1.100).rx_txt()
我想使用rp_remote_acquire通过环形缓冲区实现更高的吞吐量。
由于 stackoverflow,我能够./rp_remote_acquire
在 Red Pitaya(服务器)和 linux 机器(客户端)上执行。
/tmp/out
每次在 Red Pitaya 上执行以下命令时,我都会得到一些独特的内容(这表明服务器上的程序可以访问其硬件中的数据)。
rm /tmp/out
./rp_remote_acquire -m 3
cat /tmp/out
为了将数据从 Red Pitaya(客户端)传输到 linux 机器(服务器),我./rp_remote_acquire
使用以下参数启动:
服务器 ( 192.169.1.100
):
./rp_remote_acquire -m 2 -a 192.169.1.102 -p 14000
客户 ( 192.169.1.102
):
./rp_remote_acquire -m 1 -a 192.169.1.100 -p 14000
在哪里:
-m --mode <(1|client)|(2|server)|(3|file)>
operating mode (default client)
-a --address <ip_address>
target address in client mode (default empty)
-p --port <port_num>
port number in client and server mode (default 14000)
两台机器都能够相互ping通,并且机器能够建立连接(即int connection_start(option_fields_t *options, struct handles *handles) at transfer.c:251
返回零)。
客户端最终从transfer.c执行以下代码片段
533 while (!size || transferred < size) {
(gdb) n
534 if (pos == buf_size)
(gdb) n
539 if (pos + CHUNK <= curr) {
(gdb) n
552 memcpy(buf, mapped_base + pos, len);
(gdb) n
554 if (handles->sock >= 0) {
(gdb) n
552 memcpy(buf, mapped_base + pos, len);
(gdb) n
554 if (handles->sock >= 0) {
(gdb) n
555 if (send_buffer(handles->sock, options, buf, len) < 0) {
(gdb) n
569 pos += len;
(gdb) n
533 while (!size || transferred < size) {
似乎客户端实际上只是在执行以下操作(size = 0
默认情况下注意):
533 while (!size || transferred < size) {
552 memcpy(buf, mapped_base + pos, len);
552 memcpy(buf, mapped_base + pos, len);
569 pos += len;
}
这种行为似乎是程序员的意图,因为一旦服务器停止,客户端就会停止:
554 if (handles->sock >= 0) {
(gdb)
556 if (!interrupted)
size
当我更改为不等于零(=> 较小的数据包?)时,程序不会陷入此循环。
我希望能够访问(希望)从 Red Pitaya(服务器)发送到 linux 机器(客户端)的数据,并以某种方式使这些数据可用于客户端机器上的 python 程序。
我的问题:
这里发生了什么,我如何访问数据?
我是否需要在客户端上同步运行第二个程序,以某种方式读取
rp_remote_acquire
复制到客户端内存中的数据?