{"id":7089,"date":"2022-12-20T19:35:14","date_gmt":"2022-12-20T22:35:14","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/__ppc_get_timebase-man3\/"},"modified":"2022-12-20T19:35:14","modified_gmt":"2022-12-20T22:35:14","slug":"__ppc_get_timebase-man3","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/__ppc_get_timebase-man3\/","title":{"rendered":"__PPC_GET_TIMEBASE (man3)"},"content":{"rendered":"<h1 align=\"center\">__PPC_GET_TIMEBASE<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#RETURN VALUE\">RETURN VALUE<\/a><br \/> <a href=\"#VERSIONS\">VERSIONS<\/a><br \/> <a href=\"#CONFORMING TO\">CONFORMING TO<\/a><br \/> <a href=\"#EXAMPLES\">EXAMPLES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a><br \/> <a href=\"#COLOPHON\">COLOPHON<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">__ppc_get_timebase, __ppc_get_timebase_freq \u2212 get the current value <br \/> of the Time Base Register on Power architecture and its frequency.<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <sys\/platform\/ppc.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>uint64_t __ppc_get_timebase(void)<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>uint64_t __ppc_get_timebase_freq(void);<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>__ppc_get_timebase<\/b>() reads the current value of the Time Base Register and returns its value, while <b>__ppc_get_timebase_freq<\/b>() returns the frequency in which the Time Base Register is updated.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The Time Base Register is a 64-bit register provided by Power Architecture processors. It stores a monotonically incremented value that is updated at a system-dependent frequency that may be different from the processor frequency.<\/p>\n<h2>RETURN VALUE <a name=\"RETURN VALUE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>__ppc_get_timebase<\/b>() returns a 64-bit unsigned integer that represents the current value of the Time Base Register.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>__ppc_get_timebase_freq<\/b>() returns a 64-bit unsigned integer that represents the frequency at which the Time Base Register is updated.<\/p>\n<h2>VERSIONS <a name=\"VERSIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">GNU C Library support for <b>__ppc_get_timebase<\/b>() has been provided since version 2.16 and <b>__ppc_get_timebase_freq<\/b>() has been available since version 2.17.<\/p>\n<h2>CONFORMING TO <a name=\"CONFORMING TO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Both functions are nonstandard GNU extensions.<\/p>\n<h2>EXAMPLES <a name=\"EXAMPLES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The following program will calculate the time, in microseconds, spent between two calls to <b>__ppc_get_timebase<\/b>().<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>Program source<\/b> <br \/> #include <inttypes.h> <br \/> #include <stdint.h> <br \/> #include <stdio.h> <br \/> #include <stdlib.h> <br \/> #include <sys\/platform\/ppc.h><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/* Maximum value of the Time Base Register: 2^60 \u2212 1. <br \/> Source: POWER ISA. bodies\/ usr\/ <br \/> #define MAX_TB 0xFFFFFFFFFFFFFFF<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">int <br \/> main(void) <br \/> { <br \/> uint64_t tb1, tb2, diff;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">uint64_t freq = __ppc_get_timebase_freq(); <br \/> printf(&#8220;Time Base frequency = %&#8221;PRIu64&#8243; Hzn&#8221;, freq);<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">tb1 = __ppc_get_timebase();<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">\/\/ Do some stuff&#8230;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">tb2 = __ppc_get_timebase();<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">if (tb2 > tb1) { <br \/> diff = tb2 \u2212 tb1; <br \/> } else { <br \/> \/bin \/boot \/dead.letter \/dev \/etc \/home \/initrd \/lib \/lib64 \/lost+found \/media \/mnt \/opt \/proc \/release-notes.html \/release-notes.txt \/root \/run \/sbin \/srv \/sys \/tmp \/usr \/var Treat Time Base Register overflow. bodies\/ usr\/ <br \/> diff = (MAX_TB \u2212 tb2) + tb1; <br \/> }<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">printf(&#8220;Elapsed time = %1.2f usecsn&#8221;, <br \/> (double) diff bodies manpages.csv script_extrae_body.sh script.sh usr 1000000 \/ freq );<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">exit(EXIT_SUCCESS); <br \/> }<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>time<\/b>(2), <b>usleep<\/b>(3)<\/p>\n<h2>COLOPHON <a name=\"COLOPHON\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">This page is part of release 5.10 of the Linux <i>man-pages<\/i> project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https:\/\/www.kernel.org\/doc\/man\u2212pages\/.<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  __ppc_get_timebase, __ppc_get_timebase_freq \u2212 get the current value  of the Time Base Register on Power architecture and its frequency. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2536],"tags":[3433,2538,3007],"class_list":["post-7089","post","type-post","status-publish","format-standard","hentry","category-3-llamadas-de-bibliotecas","tag-__ppc_get_timebase","tag-2538","tag-man3"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7089","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=7089"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/7089\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=7089"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=7089"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=7089"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}