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 2023/01/19 18:29:07 UTC

[GitHub] [nuttx] xiaoxiang781216 opened a new pull request, #8196: time.h: Add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID definition

xiaoxiang781216 opened a new pull request, #8196:
URL: https://github.com/apache/nuttx/pull/8196

   ## Summary
   
   see the spec here:
   https://pubs.opengroup.org/onlinepubs/000095399/functions/clock_getres.html
   
   ## Impact
   
   new macro
   
   ## Testing
   
   Pass CI


-- 
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] [nuttx] acassis commented on a diff in pull request #8196: time.h: Add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID definition

Posted by GitBox <gi...@apache.org>.
acassis commented on code in PR #8196:
URL: https://github.com/apache/nuttx/pull/8196#discussion_r1081845991


##########
include/time.h:
##########
@@ -64,28 +64,38 @@
  * forward and backward as the system time-of-day clock is changed.
  */
 
-#define CLOCK_REALTIME     0
+#define CLOCK_REALTIME            0
 
 /* Clock that cannot be set and represents monotonic time since some
  * unspecified starting point. It is not affected by changes in the
  * system time-of-day clock.
  */
 
-#define CLOCK_MONOTONIC    1
+#define CLOCK_MONOTONIC           1
+
+/* Clock that measures CPU time consumed by this process (i.e., CPU
+ * time consumed by all threads in the process).
+ */
+
+#define CLOCK_PROCESS_CPUTIME_ID  2
+
+/* Clock that measures CPU time consumed by this thread */
+
+#define CLOCK_THREAD_CPUTIME_ID   3
 
 /* Monotonic system-wide clock that includes time spent in suspension. */
 
-#define CLOCK_BOOTTIME     2
+#define CLOCK_BOOTTIME            7

Review Comment:
   Why to use 7 instead of 4? Are you planing to add later symbols from 4 to 6 ?



-- 
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] [nuttx] pkarashchenko merged pull request #8196: time.h: Add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID definition

Posted by "pkarashchenko (via GitHub)" <gi...@apache.org>.
pkarashchenko merged PR #8196:
URL: https://github.com/apache/nuttx/pull/8196


-- 
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] [nuttx] pkarashchenko commented on a diff in pull request #8196: time.h: Add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID definition

Posted by GitBox <gi...@apache.org>.
pkarashchenko commented on code in PR #8196:
URL: https://github.com/apache/nuttx/pull/8196#discussion_r1082249826


##########
include/time.h:
##########
@@ -64,28 +64,38 @@
  * forward and backward as the system time-of-day clock is changed.
  */
 
-#define CLOCK_REALTIME     0
+#define CLOCK_REALTIME            0
 
 /* Clock that cannot be set and represents monotonic time since some
  * unspecified starting point. It is not affected by changes in the
  * system time-of-day clock.
  */
 
-#define CLOCK_MONOTONIC    1
+#define CLOCK_MONOTONIC           1
+
+/* Clock that measures CPU time consumed by this process (i.e., CPU
+ * time consumed by all threads in the process).
+ */
+
+#define CLOCK_PROCESS_CPUTIME_ID  2
+
+/* Clock that measures CPU time consumed by this thread */
+
+#define CLOCK_THREAD_CPUTIME_ID   3
 
 /* Monotonic system-wide clock that includes time spent in suspension. */
 
-#define CLOCK_BOOTTIME     2
+#define CLOCK_BOOTTIME            7

Review Comment:
   I think we should not blindly follow Linux. Let's define to 4 and than redefine later if we need to add other clock types. I mean, what do we gain from getting the same numbers? Only if Linux apps are using pure values instead of defines and we what to run those without modifications.
   I even would vote to leave values as they are and add `CLOCK_PROCESS_CPUTIME_ID` and `CLOCK_THREAD_CPUTIME_ID` as `3` and `4`



-- 
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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8196: time.h: Add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID definition

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8196:
URL: https://github.com/apache/nuttx/pull/8196#discussion_r1082636862


##########
include/time.h:
##########
@@ -64,28 +64,38 @@
  * forward and backward as the system time-of-day clock is changed.
  */
 
-#define CLOCK_REALTIME     0
+#define CLOCK_REALTIME            0
 
 /* Clock that cannot be set and represents monotonic time since some
  * unspecified starting point. It is not affected by changes in the
  * system time-of-day clock.
  */
 
-#define CLOCK_MONOTONIC    1
+#define CLOCK_MONOTONIC           1
+
+/* Clock that measures CPU time consumed by this process (i.e., CPU
+ * time consumed by all threads in the process).
+ */
+
+#define CLOCK_PROCESS_CPUTIME_ID  2
+
+/* Clock that measures CPU time consumed by this thread */
+
+#define CLOCK_THREAD_CPUTIME_ID   3
 
 /* Monotonic system-wide clock that includes time spent in suspension. */
 
-#define CLOCK_BOOTTIME     2
+#define CLOCK_BOOTTIME            7

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] [nuttx] xiaoxiang781216 commented on a diff in pull request #8196: time.h: Add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID definition

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on code in PR #8196:
URL: https://github.com/apache/nuttx/pull/8196#discussion_r1082182720


##########
include/time.h:
##########
@@ -64,28 +64,38 @@
  * forward and backward as the system time-of-day clock is changed.
  */
 
-#define CLOCK_REALTIME     0
+#define CLOCK_REALTIME            0
 
 /* Clock that cannot be set and represents monotonic time since some
  * unspecified starting point. It is not affected by changes in the
  * system time-of-day clock.
  */
 
-#define CLOCK_MONOTONIC    1
+#define CLOCK_MONOTONIC           1
+
+/* Clock that measures CPU time consumed by this process (i.e., CPU
+ * time consumed by all threads in the process).
+ */
+
+#define CLOCK_PROCESS_CPUTIME_ID  2
+
+/* Clock that measures CPU time consumed by this thread */
+
+#define CLOCK_THREAD_CPUTIME_ID   3
 
 /* Monotonic system-wide clock that includes time spent in suspension. */
 
-#define CLOCK_BOOTTIME     2
+#define CLOCK_BOOTTIME            7

Review Comment:
   Follow the Linux definition here:
   https://github.com/torvalds/linux/blob/master/include/uapi/linux/time.h#L56



-- 
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] [nuttx] xiaoxiang781216 commented on pull request #8196: time.h: Add CLOCK_PROCESS_CPUTIME_ID and CLOCK_THREAD_CPUTIME_ID definition

Posted by "xiaoxiang781216 (via GitHub)" <gi...@apache.org>.
xiaoxiang781216 commented on PR #8196:
URL: https://github.com/apache/nuttx/pull/8196#issuecomment-1404785107

   ping @pkarashchenko 


-- 
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