www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to use "cpuid" in tango?

reply Benji Smith <dlanguage benjismith.net> writes:
I went looking for the cpuid functionality in tango, and I found this:

http://dsource.org/projects/tango/browser/trunk/lib/compiler/dmd/util/cpuid.d

...which is a verbatim copy of the phobos implementation, and it's 
exactly what a want. But it's in the compiler support library, with 
stuff like aaA.d and obj.d. It seems like these bits of code of 
deliberately (and deservedly) out of reach for user code.

I can copy the cpuid.d file into my own project (which is actually what 
I've been doing so far), but it seems like a very clunky way of doing 
things.

Any tips?

--benji
Sep 11 2008
parent reply Lars Ivar Igesund <larsivar igesund.net> writes:
Benji Smith wrote:

 I went looking for the cpuid functionality in tango, and I found this:
 
http://dsource.org/projects/tango/browser/trunk/lib/compiler/dmd/util/cpuid.d
 
 ...which is a verbatim copy of the phobos implementation, and it's
 exactly what a want. But it's in the compiler support library, with
 stuff like aaA.d and obj.d. It seems like these bits of code of
 deliberately (and deservedly) out of reach for user code.
 
 I can copy the cpuid.d file into my own project (which is actually what
 I've been doing so far), but it seems like a very clunky way of doing
 things.
It isn't meant not to be used, the interface to expose it to users just haven't been added yet. There should be a relevant ticket :) -- Lars Ivar Igesund blog at http://larsivi.net DSource, #d.tango & #D: larsivi Dancing the Tango
Sep 11 2008
parent reply Benji Smith <dlanguage benjismith.net> writes:
Lars Ivar Igesund wrote:
 Benji Smith wrote:
 
 I went looking for the cpuid functionality in tango, and I found this:
http://dsource.org/projects/tango/browser/trunk/lib/compiler/dmd/util/cpuid.d
 ...which is a verbatim copy of the phobos implementation, and it's
 exactly what a want. But it's in the compiler support library, with
 stuff like aaA.d and obj.d. It seems like these bits of code of
 deliberately (and deservedly) out of reach for user code.

 I can copy the cpuid.d file into my own project (which is actually what
 I've been doing so far), but it seems like a very clunky way of doing
 things.
It isn't meant not to be used, the interface to expose it to users just haven't been added yet. There should be a relevant ticket :)
Yep, sure enough, there's a ticket: http://dsource.org/projects/tango/ticket/371 I should have searched for it first. Sorry to pester. --benji
Sep 11 2008
parent Sean Kelly <sean invisibleduck.org> writes:
Benji Smith wrote:
 Lars Ivar Igesund wrote:
 Benji Smith wrote:

 I went looking for the cpuid functionality in tango, and I found this:
http://dsource.org/projects/tango/browser/trunk/lib/compiler/dmd/util/cpuid.d
 ...which is a verbatim copy of the phobos implementation, and it's
 exactly what a want. But it's in the compiler support library, with
 stuff like aaA.d and obj.d. It seems like these bits of code of
 deliberately (and deservedly) out of reach for user code.

 I can copy the cpuid.d file into my own project (which is actually what
 I've been doing so far), but it seems like a very clunky way of doing
 things.
It isn't meant not to be used, the interface to expose it to users just haven't been added yet. There should be a relevant ticket :)
Yep, sure enough, there's a ticket: http://dsource.org/projects/tango/ticket/371 I should have searched for it first. Sorry to pester.
No problem. The cpuid module you found was actually added to support the new array operations, much as 'utf' in the same package is present to support foreach UTF conversions, etc. In short, the stuff you see in lib/compiler/dmd/util is support code for the DMD runtime--another runtime may not need the same code to provide the same features. However, I do like the idea of adding a cpuid module to Tango. Particularly with Don's latest stuff for obtaining cache info. So one will be added in user-space at some point. Sean
Sep 11 2008