- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- nanosecond
Operating System - HP-UX
1756076
Members
4075
Online
108840
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2003 05:52 PM
тАО11-24-2003 05:52 PM
Hi. Admins.
Is there any method to get nanosecond in the HP?
I used "gethrtime" and "clock_gettime", but they only returned "microsecond"..
please, Help me..
Thanks in advance.
Is there any method to get nanosecond in the HP?
I used "gethrtime" and "clock_gettime", but they only returned "microsecond"..
please, Help me..
Thanks in advance.
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2003 07:26 PM
тАО11-24-2003 07:26 PM
Re: nanosecond
hi,
Perhaps have you been too fast when reading clock_gettime man page. It seems to be able to manage nanoseconds. You even have an example :
#include
#include
struct timespec resolution;
if (clock_getres(CLOCK_PROFILE, &resolution)) {
perror("clock_getres(CLOCK_PROFILE) failed");
exit(1);
}
(void)printf("Resolution of user profiling clock is:\n");
(void)printf("%d seconds and %d nanoseconds.\n",
resolution.tv_sec, resolution.tv_nsec);
Regards.
Perhaps have you been too fast when reading clock_gettime man page. It seems to be able to manage nanoseconds. You even have an example :
#include
#include
struct timespec resolution;
if (clock_getres(CLOCK_PROFILE, &resolution)) {
perror("clock_getres(CLOCK_PROFILE) failed");
exit(1);
}
(void)printf("Resolution of user profiling clock is:\n");
(void)printf("%d seconds and %d nanoseconds.\n",
resolution.tv_sec, resolution.tv_nsec);
Regards.
It works for me (┬й Bill McNAMARA ...)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2003 07:43 PM
тАО11-24-2003 07:43 PM
Re: nanosecond
Thanks to your answer. but,
I think i should have explained my questions more detail..
My problem is that when I wrote program like below
------------------------------------------
for ( i=0;i<10;i++){
if (clock_gettime(CLOCK_REALTIME, &cur_time)) {
perror("clock_gettime(CLOCK_REALTIME) failed");
exit(1);
}
printf("%ld nsec\n", cur_time.tv_nsec );
the result looks like below.
--------------------
143781000 nsec
143811000 nsec
143839000 nsec
143868000 nsec
143896000 nsec
143923000 nsec
143951000 nsec
143978000 nsec
144006000 nsec
144033000 nsec
The last three digits are always "0"
Do i have to tun some kernel parameters?
I think i should have explained my questions more detail..
My problem is that when I wrote program like below
------------------------------------------
for ( i=0;i<10;i++){
if (clock_gettime(CLOCK_REALTIME, &cur_time)) {
perror("clock_gettime(CLOCK_REALTIME) failed");
exit(1);
}
printf("%ld nsec\n", cur_time.tv_nsec );
the result looks like below.
--------------------
143781000 nsec
143811000 nsec
143839000 nsec
143868000 nsec
143896000 nsec
143923000 nsec
143951000 nsec
143978000 nsec
144006000 nsec
144033000 nsec
The last three digits are always "0"
Do i have to tun some kernel parameters?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-24-2003 09:13 PM
тАО11-24-2003 09:13 PM
Solution
Hi,
You seem to be right. I think that it's related to clock resolution too high. But gethrtime() works better although it's not related to time of day. Using these progs :
A - no sleep() :
#include
main()
{
int i;
for ( i=0;i<3;i++)
{
printf("%lld nsec\n", gethrtime());
}
}
home> myprog
6652778157318723 nsec
6652778158086617 nsec
6652778158111862 nsec
B - with sleep() :
#include
#include
main()
{
int i;
for ( i=0;i<3;i++, sleep(1))
{
printf("%lld nsec\n", gethrtime());
}
}
home > myprog
6652972898147057 nsec
6652973900562902 nsec
6652974910552897 nsec
I can really see increments around 1 second. Be careful to use %lld !!!
Regards.
You seem to be right. I think that it's related to clock resolution too high. But gethrtime() works better although it's not related to time of day. Using these progs :
A - no sleep() :
#include
main()
{
int i;
for ( i=0;i<3;i++)
{
printf("%lld nsec\n", gethrtime());
}
}
home> myprog
6652778157318723 nsec
6652778158086617 nsec
6652778158111862 nsec
B - with sleep() :
#include
#include
main()
{
int i;
for ( i=0;i<3;i++, sleep(1))
{
printf("%lld nsec\n", gethrtime());
}
}
home > myprog
6652972898147057 nsec
6652973900562902 nsec
6652974910552897 nsec
I can really see increments around 1 second. Be careful to use %lld !!!
Regards.
It works for me (┬й Bill McNAMARA ...)
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP