Hi,
I have an application that runs on FreeBSD and Linux which requires calling lots of ioctl. Through a simple "for" loop calling a custom ioctl, I get the following duration:
Is there a way to optimize the ioctl call in FreeBSD to have similar performance as Linux?
I have an application that runs on FreeBSD and Linux which requires calling lots of ioctl. Through a simple "for" loop calling a custom ioctl, I get the following duration:
C:
#ifdef __linux__
fd = open("/dev/test_device", O_RDWR);
#else
fd = open("/dev/test", O_RDWR);
#endif
if(fd < 0)
{
printf("Cannot open device file...\n");
return 0;
}
gettimeofday(&tv1, NULL);
for (i = 0; i < 0xffffff; i++)
ioctl(fd, IOCTL_TEST, NULL);
gettimeofday(&tv2, NULL);
printf ("Total time = %f us\n",
(double) (tv2.tv_usec - tv1.tv_usec) +
(double) ((tv2.tv_sec - tv1.tv_sec) * 1000000));
close(fd);
Duration(us) | |
---|---|
FreeBSD 14.0 | 1559924 |
Linux - Ubuntu 20.04.6 LTS | 841341 |
Is there a way to optimize the ioctl call in FreeBSD to have similar performance as Linux?
Last edited by a moderator: