[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: getting number of processors on user machine
From:       "Christopher Blauvelt" <cblauvelt () gmail ! com>
Date:       2006-08-28 6:41:50
Message-ID: ffa898c90608272341o7c239ef9n77e42255137aa053 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]

[Attachment #4 (text/plain)]

This is also provided by the solid interace by examining the contents the
list returned by:
Solid::DeviceList devlist =
Solid::DeviceManager::self()->findDevicesFromQuery(QString(),
Solid::Capability::Processor);
and listing the processors that have the same parentUDI:
QMap<QString, QList<Solid::Device> > processormap;
foreach(Solid::Device dev, devlist)
{
    processormap[dev.parentUDI()] << dev;
}

for clarification DeviceList is a typdef of QList<Solid::Device>.
BTW if you want to look more at Solid take a look at the wiki:
http://solid.kde.org/wiki.
Under the Help section there are instructions on how to set up a
build environment.



On 8/28/06, Krzysztof Lichota <krzysiek@lichota.net> wrote:
>
> Aaron J. Seigo napisał(a):
> > On Sunday 27 August 2006 20:00, Nasser wrote:
> >> can i read this from a file, or is it an environment variable? i will
> >
> > there is no portable way to do this, so you'll need various operating
> system
> > specific implementations... on linux you could do:
> >
> >       long numCPUs = sysconf(_SC_NPROCESSORS_CONF);
>
> If on Linux, it is also easy to examine contents of /proc/cpuinfo.
> It gives more information about sibling processors and processor features.
>
>        Krzysztof Lichota
>
>
>
>
> >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to
> unsubscribe <<
>
>
>
>

[Attachment #5 (text/html)]

<div>This is also provided by the solid interace by examining the contents the list \
returned by:</div> <div>Solid::DeviceList devlist = \
Solid::DeviceManager::self()-&gt;findDevicesFromQuery(QString(), \
Solid::Capability::Processor);</div> <div>and listing the processors that have the \
same parentUDI:</div> <div>QMap&lt;QString, QList&lt;Solid::Device&gt; &gt; \
processormap;</div> <div>foreach(Solid::Device dev, devlist)</div>
<div>{</div>
<div>&nbsp;&nbsp;&nbsp; processormap[dev.parentUDI()] &lt;&lt; dev;</div>
<div>}</div>
<p>for clarification DeviceList is a typdef of QList&lt;Solid::Device&gt;.</p>
<div>BTW if you want to look more at Solid take a look at the wiki: <a \
href="http://solid.kde.org/wiki">http://solid.kde.org/wiki</a>.</div> <div>Under the \
Help section there are instructions on how to set up a build&nbsp;environment.</div> \
<div><br><br>&nbsp;</div> <div><span class="gmail_quote">On 8/28/06, <b \
class="gmail_sendername">Krzysztof Lichota</b> &lt;<a \
href="mailto:krzysiek@lichota.net">krzysiek@lichota.net</a>&gt; wrote:</span> \
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; \
BORDER-LEFT: #ccc 1px solid">Aaron J. Seigo napisał(a):<br>&gt; On Sunday 27 August \
2006 20:00, Nasser wrote:<br>&gt;&gt; can i read this from a file, or is it an \
environment variable? i will <br>&gt;<br>&gt; there is no portable way to do this, so \
you'll need various operating system<br>&gt; specific implementations... on linux you \
could do:<br>&gt;<br>&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; long numCPUs = \
sysconf(_SC_NPROCESSORS_CONF);<br> <br>If on Linux, it is also easy to examine \
contents of /proc/cpuinfo.<br>It gives more information about sibling processors and \
processor features.<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Krzysztof \
Lichota<br><br><br><br><br>&gt;&gt; Visit <a \
href="http://mail.kde.org/mailman/listinfo/kde-devel#unsub"> \
http://mail.kde.org/mailman/listinfo/kde-devel#unsub</a> to unsubscribe \
&lt;&lt;<br><br><br><br></blockquote></div><br>



>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic