CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Question how to get CPU ID?

    How i can get CPU ID.
    the OS i use is Fedora 10.
    Please rate my post if it was helpful for you.
    Java, C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

  2. #2
    Join Date
    Nov 2007
    Location
    Birmingham, England
    Posts
    157

    Re: how to get CPU ID?

    CPUid is an optional module in the linux kernel.

    http://manpages.courier-mta.org/htmlman4/cpuid.4.html

    If you are looking for the Unique processor serial number then this was removed after pentium 3 (Human rights protestors forced intel to remove it on privacy grounds).

    Regards
    Signature
    Please use: [ code ][/ code ] tags and reasonably correct tabbing. They really help us read your code
    End Signature

  3. #3
    Join Date
    Mar 2008
    Location
    IRAN
    Posts
    811

    Re: how to get CPU ID?

    thanks for the link.

    but i need a solution that i can implement it with both java code and c++.
    in my java code i use aspect and i can not invoke c++ dll when i use aspect. so i should write code both in java and c++ that both of them generate same CPU ID or something realted to CPU ID that is unique.

    please help me.
    Please rate my post if it was helpful for you.
    Java, C#, C++, PHP, ASP.NET
    SQL Server, MySQL
    DirectX
    MATH
    Touraj Ebrahimi
    [toraj_e] [at] [yahoo] [dot] [com]

  4. #4
    Join Date
    Nov 2007
    Location
    Birmingham, England
    Posts
    157

    Re: how to get CPU ID?

    Quote Originally Posted by toraj58 View Post
    so i should write code both in java and c++ that both of them generate same CPU ID or something realted to CPU ID that is unique.
    Thats exactly what you can't do. Any two processors of the same model will have the same CPUID (unless they're pentium III).
    According to Wikipedia (http://en.wikipedia.org/wiki/CPUID#E..._Serial_Number):
    The processor serial number was introduced on Intel Pentium III, but due to privacy concern, this feature is no longer implemented on later models (PSN feature bit is always cleared). Transmeta's Efficeon and Crusoe processors also provide this feature. AMD CPUs however, do not implement this feature in any CPU models.
    On the off chance that you know the processors you're going to run your code on will support this feature, then you could used the suggested drivers in linux and access the /proc/cpuid file from both java and c++.

    Alternative
    If you're trying to uniquely identify a computer, you're more likely to be able to do so by taking the hard disk serial number (to avoid ambiguity, try to locate the hard disk containing the root partition). I've never done this myself so Google is your friend here.

    Hope this is of some help
    Signature
    Please use: [ code ][/ code ] tags and reasonably correct tabbing. They really help us read your code
    End Signature

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured