Sponsored Content
Full Discussion: Accessing TSC Register
Top Forums Programming Accessing TSC Register Post 302394063 by Corona688 on Wednesday 10th of February 2010 10:43:27 AM
Old 02-10-2010
TSC is in fact munged by dual or quad core systems, and also by power-saving features that change the CPU clock rate. In any event I'm not convinced your inline assembly is working, being raw hex there. I've found some source here with perhaps a better implementation:
Code:
/*
 * get_tsc()
 */
static unsigned long long get_tsc(void)
{
	unsigned long long tsc;
	__asm__ __volatile__ ("rdtsc" : "=A" (tsc));
	return tsc;
}

You may need to change 'long long' to just 'long' on 64-bit systems. Or better yet, #include <stdint.h> and use uint64_t for code that should work on both...
 

8 More Discussions You Might Find Interesting

1. Forum Support Area for Unregistered Users & Account Problems

Can't register

I tried registering, but no matter what email address I provide, it says not a valid address and not the same in confirm. I tried many times, but no go. I thought I had already registered as Sully but even that didn't like my email address for password info. Of course, that could be someone else... (2 Replies)
Discussion started by: Not registered
2 Replies

2. Forum Support Area for Unregistered Users & Account Problems

Not able to register

I tried my best to register myself on unix.com but i am not lucky, can you pls give me instruction. (1 Reply)
Discussion started by: Kuldeep_Sngh333
1 Replies

3. Forum Support Area for Unregistered Users & Account Problems

Cant register

Registration denied. Sorry, The UNIX and Linux Forums runs an active policy of not allowing spammers. Please contact us via by posting in this forum if you believe this is in error What's with this? Tried 2 email accounts in case your forum blocks either. (1 Reply)
Discussion started by: Diagonal
1 Replies

4. Forum Support Area for Unregistered Users & Account Problems

Can not register

I need help from the scripting threads and want to register. I tried it several times, but I was all the time rejected, because of your spam policy. I do what you have written, but I wasn't still able to register. (1 Reply)
Discussion started by: ScAr
1 Replies

5. Forum Support Area for Unregistered Users & Account Problems

I can't register

Hello admin, I come from Vietnam, it's in blocked country list. Can you help me to register I want to register with following information: Username: bojankikrick Email: <removed> Thanks very much! (1 Reply)
Discussion started by: Unregistered
1 Replies

6. Forum Support Area for Unregistered Users & Account Problems

I can't register

hi,admin: i come from china,my country is in the blocked list.i want to register a account,can you help me? infomation: username: zhengzfand email:<removed> (1 Reply)
Discussion started by: Unregistered
1 Replies

7. Forum Support Area for Unregistered Users & Account Problems

Can't register

I am in China. China is in the blocked country list. I can't register. And I don't have a static ip. Can u help me to fix it. I want to register with following information: Username:liuchengzhang email:<removed> Thanks! (1 Reply)
Discussion started by: liuchengzhang
1 Replies

8. Forum Support Area for Unregistered Users & Account Problems

Cannot able to Register!

Hi Admin, I am unable to register . Request you to help me in getting my registration done. Name: Raghavendra Kulkarni Mail id : <removed> Thanking you in advance for your support. (1 Reply)
Discussion started by: Unregistered
1 Replies
Helpers for manipulating Linux libnuma unsigned long masks(3)Hardware Locality (hwlocHelpers for manipulating Linux libnuma unsigned long masks(3)

NAME
Helpers for manipulating Linux libnuma unsigned long masks - Functions static inline int hwloc_cpuset_to_linux_libnuma_ulongs (hwloc_topology_t topology, hwloc_const_cpuset_t cpuset, unsigned long *mask, unsigned long *maxnode) static inline int hwloc_nodeset_to_linux_libnuma_ulongs (hwloc_topology_t topology, hwloc_const_nodeset_t nodeset, unsigned long *mask, unsigned long *maxnode) static inline int hwloc_cpuset_from_linux_libnuma_ulongs (hwloc_topology_t topology, hwloc_cpuset_t cpuset, const unsigned long *mask, unsigned long maxnode) static inline int hwloc_nodeset_from_linux_libnuma_ulongs (hwloc_topology_t topology, hwloc_nodeset_t nodeset, const unsigned long *mask, unsigned long maxnode) Detailed Description Function Documentation static inline int hwloc_cpuset_from_linux_libnuma_ulongs (hwloc_topology_ttopology, hwloc_cpuset_tcpuset, const unsigned long *mask, unsigned longmaxnode) [static] Convert the array of unsigned long mask into hwloc CPU set. mask is a array of unsigned long that will be read. maxnode contains the maximal node number that may be read in mask. This function may be used after calling get_mempolicy or any other function that takes an array of unsigned long as output parameter (and possibly a maximal node number as input parameter). static inline int hwloc_cpuset_to_linux_libnuma_ulongs (hwloc_topology_ttopology, hwloc_const_cpuset_tcpuset, unsigned long *mask, unsigned long *maxnode) [static] Convert hwloc CPU set cpuset into the array of unsigned long mask. mask is the array of unsigned long that will be filled. maxnode contains the maximal node number that may be stored in mask. maxnode will be set to the maximal node number that was found, plus one. This function may be used before calling set_mempolicy, mbind, migrate_pages or any other function that takes an array of unsigned long and a maximal node number as input parameter. static inline int hwloc_nodeset_from_linux_libnuma_ulongs (hwloc_topology_ttopology, hwloc_nodeset_tnodeset, const unsigned long *mask, unsigned longmaxnode) [static] Convert the array of unsigned long mask into hwloc NUMA node set. mask is a array of unsigned long that will be read. maxnode contains the maximal node number that may be read in mask. This function may be used after calling get_mempolicy or any other function that takes an array of unsigned long as output parameter (and possibly a maximal node number as input parameter). static inline int hwloc_nodeset_to_linux_libnuma_ulongs (hwloc_topology_ttopology, hwloc_const_nodeset_tnodeset, unsigned long *mask, unsigned long *maxnode) [static] Convert hwloc NUMA node set nodeset into the array of unsigned long mask. mask is the array of unsigned long that will be filled. maxnode contains the maximal node number that may be stored in mask. maxnode will be set to the maximal node number that was found, plus one. This function may be used before calling set_mempolicy, mbind, migrate_pages or any other function that takes an array of unsigned long and a maximal node number as input parameter. Author Generated automatically by Doxygen for Hardware Locality (hwloc) from the source code. Version 1.7 Sun Apr 7 2013 Helpers for manipulating Linux libnuma unsigned long masks(3)
All times are GMT -4. The time now is 12:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy