Solid
tutorial3.cpp
Go to the documentation of this file.00001 /* This file is part of the KDE project 00002 Copyright (C) 2007 Christopher Blauvelt <cblauvelt@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or 00005 modify it under the terms of the GNU Library General Public 00006 License version 2 as published by the Free Software Foundation. 00007 00008 This library is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 Library General Public License for more details. 00012 00013 You should have received a copy of the GNU Library General Public License 00014 along with this library; see the file COPYING.LIB. If not, write to 00015 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 00016 Boston, MA 02110-1301, USA. 00017 00018 */ 00019 00020 //QT specific includes 00021 #include <QList> 00022 00023 //solid specific includes 00024 #include <solid/devicenotifier.h> 00025 #include <solid/device.h> 00026 #include <solid/deviceinterface.h> 00027 #include <solid/processor.h> 00028 00029 //kde specific includes 00030 #include <kcomponentdata.h> 00031 #include <kcmdlineargs.h> 00032 #include <klocale.h> 00033 #include <kdebug.h> 00034 00035 #include <iostream> 00036 00037 using namespace std; 00038 00039 int main(int args, char **argv) 00040 { 00041 KComponentData componentData("tutorial3"); 00042 00043 //get a Processor 00044 QList<Solid::Device> list = Solid::Device::listFromType(Solid::DeviceInterface::Processor, QString()); 00045 00046 //take the first processor 00047 Solid::Device device = list[0]; 00048 if(device.is<Solid::Processor>()) kDebug() << "We've got a processor!" << list.count() << "to be exact..."; 00049 else kDebug() << "Device is not a processor."; 00050 00051 Solid::Processor *processor = device.as<Solid::Processor>(); 00052 kDebug() << "This processors maximum speed is: " << processor->maxSpeed(); 00053 00054 Solid::Processor::InstructionSets extensions = processor->instructionSets(); 00055 kDebug() << "Intel MMX supported:" << (bool)(extensions & Solid::Processor::IntelMmx); 00056 kDebug() << "Intel SSE supported:" << (bool)(extensions & Solid::Processor::IntelSse); 00057 kDebug() << "Intel SSE2 supported:" << (bool)(extensions & Solid::Processor::IntelSse2); 00058 kDebug() << "Intel SSE3 supported:" << (bool)(extensions & Solid::Processor::IntelSse3); 00059 kDebug() << "Intel SSE4 supported:" << (bool)(extensions & Solid::Processor::IntelSse4); 00060 kDebug() << "AMD 3DNOW supported:" << (bool)(extensions & Solid::Processor::Amd3DNow); 00061 kDebug() << "PPC AltiVec supported:" << (bool)(extensions & Solid::Processor::AltiVec); 00062 00063 return 0; 00064 } 00065 00066 #include "tutorial3.moc"