This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] Linux/TMDXIDK5728:Linux RT 常规时序问题

Guru**** 2549240 points
Other Parts Discussed in Thread: AM5728

请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/600158/linux-tmdxidk5728-linux-rt-general-timing-questions

器件型号:TMDXIDK5728

工具/软件:Linux

您好!

是否可以确认我在 Linux RT 03.03.00.04上获取的时序。

看起来像 USB 2的拇指驱动器连接到 IDK USB1插槽、这是一个 USB 3连接器。

使用 clock_gettime(),它具有纳秒计时,可以找到将1,000,000 (1百万)字节写入拇指驱动器上的文件的时间长度。 我还一直使用 Linux 'time'命令来确认我的计时代码是否正确。

我将得到大约800 Mbit/s 的数据。 我在台式 Ubuntu 计算机上尝试过此操作、并使用相同的拇指驱动器获得82至110 Mbit/s 的数据。 读取速度仍然更快、高达2700Mbit/s。 在 USB 2规范中、我可以找到的最大值为480 Mbits/sec。 这表明 IDK AM5728 Linxu RT 配置中的时钟信息可能出错。

我使用了以下代码以及 open 函数、write 函数和 close 函数。

----------------------------------------

/*
       file_write_test.c

 尝试对 USB 闪存驱动器上的文件进行写入计时
 作为文件目录分区装入的文件。

 这将创建一个文件。

*

#include
#include
#include
#include
#include
#include
#include

//########################################
//全局
#define ARRLEN   1000000

//########################################
//
//函数

float timespec (struct timespec * Timea_p、struct timespec * timeb_p)

 return (float)(((float) Timea_p->tv_sec +(float)(Timea_p->tv_nsec / 1000000000.0))-((float) timeB_p->tv_sec +(float)(time_p->tv_nsec / 1000000000.0)));



//########################################
//
//主函数

int main(){
   unsigned char txbytes[ARRLEN + 1];
   int i;
   struct timespec start、end;//计时、以秒和纳秒为单位
   浮点已过;

   //在数组中放置一些十六进制值。
   对于(I = 0;I < ARRLEN;I++)
   {
   txbytes[i]=(i % 10)+ 48;
   //printf ("\n\txbytes 值:%c"、txbytes[i]);
   }
   //printf ("\n");
   //fflush (stdout);

   //开始计时
   Clock_gettime (clock_monotonic、&start);

   int fd = open ("/media/user01/UBUNTU 14_0/zfile001.txt"、O_RDWR | O_creat);

   //开始计时
   写入(FD、txbytes、ARRLEN);

   //获得写入新打开和创建的文件的时间。

   关闭(FD);

   Clock_gettime (clock_monotonic、&end);
   
   //获得读取时间差
   已用=时间指定比较(&end、&start);
   fprintf (stderr、"\n 弹性时间=%f 秒"、已过);
   fprintf (stderr,“\n 写入速率为:%f 位/秒\n\n",(浮点数)(ARRLEN*8)/Elapsed);

   返回0;