You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/07/15 08:26:44 UTC

[GitHub] [incubator-nuttx-apps] FASTSHIFT opened a new pull request, #1219: nshlib/nsh_ddcmd: calculate time difference with microsecond precision

FASTSHIFT opened a new pull request, #1219:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1219

   ## Summary
   Improve calculation accuracy.
   
   ## Impact
   
   ## Testing
   daily test
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] FASTSHIFT commented on a diff in pull request #1219: nshlib/nsh_ddcmd: calculate time difference with microsecond precision

Posted by GitBox <gi...@apache.org>.
FASTSHIFT commented on code in PR #1219:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1219#discussion_r922076297


##########
nshlib/nsh_ddcmd.c:
##########
@@ -353,14 +353,14 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 
   elapsed  = (((uint64_t)ts1.tv_sec * NSEC_PER_SEC) + ts1.tv_nsec);
   elapsed -= (((uint64_t)ts0.tv_sec * NSEC_PER_SEC) + ts0.tv_nsec);
-  elapsed /= NSEC_PER_MSEC; /* msec */
+  elapsed /= NSEC_PER_USEC; /* usec */
 
   total = ((uint64_t)dd.sector * (uint64_t)dd.sectsize);
 
-  nsh_output(vtbl, "%llu bytes copied, %u msec, ",
+  nsh_output(vtbl, "%llu bytes copied, %u usec, ",
              total, (unsigned int)elapsed);
   nsh_output(vtbl, "%u KB/s\n" ,
-             (unsigned int)((double)total / (double)elapsed));
+             (unsigned int)((double)total * 1000 / (double)elapsed));

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] xiaoxiang781216 merged pull request #1219: nshlib/nsh_ddcmd: calculate time difference with microsecond precision

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged PR #1219:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1219


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-nuttx-apps] pkarashchenko commented on a diff in pull request #1219: nshlib/nsh_ddcmd: calculate time difference with microsecond precision

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #1219:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1219#discussion_r921971797


##########
nshlib/nsh_ddcmd.c:
##########
@@ -353,14 +353,14 @@ int cmd_dd(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 
   elapsed  = (((uint64_t)ts1.tv_sec * NSEC_PER_SEC) + ts1.tv_nsec);
   elapsed -= (((uint64_t)ts0.tv_sec * NSEC_PER_SEC) + ts0.tv_nsec);
-  elapsed /= NSEC_PER_MSEC; /* msec */
+  elapsed /= NSEC_PER_USEC; /* usec */
 
   total = ((uint64_t)dd.sector * (uint64_t)dd.sectsize);
 
-  nsh_output(vtbl, "%llu bytes copied, %u msec, ",
+  nsh_output(vtbl, "%llu bytes copied, %u usec, ",
              total, (unsigned int)elapsed);
   nsh_output(vtbl, "%u KB/s\n" ,
-             (unsigned int)((double)total / (double)elapsed));
+             (unsigned int)((double)total * 1000 / (double)elapsed));

Review Comment:
   maybe also can use define for `1000` here? similar to `NSEC_PER_USEC` at line 356?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org