[haiku-development] Re: Fixing get_cpu_model_string(), Ticket 3541

  • From: Christian Packmann <Christian.Packmann@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 20 Jun 2009 20:08:54 +0200

Axel Dörfler - 2009-06-20 17:40 :
Christian Packmann <Christian.Packmann@xxxxxx> wrote:
I'm currently breaking down the information in a "logical" format, i.e. I group all flags for MMX/SSE/3DNow! in one uint32 or string. This makes it easier for the programmer when needing specific info, as all needed information is stored in one place. For a K10, the generated string looks like this: "MMX 3DNow! 3DNow!+ SSE SSE-Integer SSE2 SSE3 SSE4a SSE128 MOVU 3DNow!Prefetch"

Strings are usually the last thing you want to mess with in an (suggested) API like this.

Not as a means of feature detection; good old bitfields are the optimum solution there. But at least for my own CPUID API it makes sense to include the ability to generate human-readable strings, as one of the main drives for development is use in my benchmarks and displaying the info to the user. And exporting the features in the "standard" Linux procfs format may make sense as well for interoperability purposes like the BOINC client.

I don't think that this string generation should be part of a OS API, at least not in the kernel. OTOH, if the OS has the code to generate these strings anyway (sysinfo), then it may make sense to move the routines to a library and make them available for other programs which may want to use this information to display it another form (GUI instead of CLI).

Christian

Other related posts: