Display "N/A" if CPU usage cannot be determined (as on Win2k).
This commit is contained in:
parent
a6ddde787e
commit
a7126f42d2
@ -2653,94 +2653,94 @@
|
|||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="320"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="322"/>
|
||||||
<source>Encoding files, please wait...</source>
|
<source>Encoding files, please wait...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="364"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="366"/>
|
||||||
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
|
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="378"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="380"/>
|
||||||
<source>Aborted! Waiting for running jobs to terminate...</source>
|
<source>Aborted! Waiting for running jobs to terminate...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="393"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="395"/>
|
||||||
<source>Encoding: %1 files of %2 completed so far, please wait...</source>
|
<source>Encoding: %1 files of %2 completed so far, please wait...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="421"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="423"/>
|
||||||
<source>Creating the playlist file, please wait...</source>
|
<source>Creating the playlist file, please wait...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="431"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="433"/>
|
||||||
<source>Process was aborted by the user after %1 file(s)!</source>
|
<source>Process was aborted by the user after %1 file(s)!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="431"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="433"/>
|
||||||
<source>Process was aborted prematurely by the user!</source>
|
<source>Process was aborted prematurely by the user!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="432"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="434"/>
|
||||||
<source>LameXP - Aborted</source>
|
<source>LameXP - Aborted</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="432"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="434"/>
|
||||||
<source>Process was aborted by the user.</source>
|
<source>Process was aborted by the user.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="444"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="446"/>
|
||||||
<source>Error: %1 of %2 files failed. Double-click failed items for detailed information!</source>
|
<source>Error: %1 of %2 files failed. Double-click failed items for detailed information!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="445"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="447"/>
|
||||||
<source>LameXP - Error</source>
|
<source>LameXP - Error</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="445"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="447"/>
|
||||||
<source>At least one file has failed!</source>
|
<source>At least one file has failed!</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="455"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="457"/>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="456"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="458"/>
|
||||||
<source>All files completed successfully.</source>
|
<source>All files completed successfully.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="456"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="458"/>
|
||||||
<source>LameXP - Done</source>
|
<source>LameXP - Done</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="844"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="846"/>
|
||||||
<source>Playlist creation failed</source>
|
<source>Playlist creation failed</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="844"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="846"/>
|
||||||
<source>The playlist file could not be created:</source>
|
<source>The playlist file could not be created:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="914"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="916"/>
|
||||||
<source>Warning: Computer will shutdown in %1 seconds...</source>
|
<source>Warning: Computer will shutdown in %1 seconds...</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="918"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="920"/>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="919"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="921"/>
|
||||||
<source>Cancel Shutdown</source>
|
<source>Cancel Shutdown</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -2653,94 +2653,94 @@
|
|||||||
<translation type="unfinished">Twoje pliki są właśnie kompresowane, prosze być cierpliwy...</translation>
|
<translation type="unfinished">Twoje pliki są właśnie kompresowane, prosze być cierpliwy...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="320"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="322"/>
|
||||||
<source>Encoding files, please wait...</source>
|
<source>Encoding files, please wait...</source>
|
||||||
<translation type="unfinished">Kompresowanie plików, prosze czekać...</translation>
|
<translation type="unfinished">Kompresowanie plików, prosze czekać...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="364"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="366"/>
|
||||||
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
|
<source>Multi-threading enabled: Running %1 instances in parallel!</source>
|
||||||
<translation type="unfinished">Wielowątkowosć włączona: Równolegle wykonywanych jest %1 kodowań!</translation>
|
<translation type="unfinished">Wielowątkowosć włączona: Równolegle wykonywanych jest %1 kodowań!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="378"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="380"/>
|
||||||
<source>Aborted! Waiting for running jobs to terminate...</source>
|
<source>Aborted! Waiting for running jobs to terminate...</source>
|
||||||
<translation type="unfinished">Przerwano! Czekanie na wyłączenie procesu...</translation>
|
<translation type="unfinished">Przerwano! Czekanie na wyłączenie procesu...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="393"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="395"/>
|
||||||
<source>Encoding: %1 files of %2 completed so far, please wait...</source>
|
<source>Encoding: %1 files of %2 completed so far, please wait...</source>
|
||||||
<translation type="unfinished">Kompresja: Prosze czekać, jak dotąd wykonano %1 z %2 plików...</translation>
|
<translation type="unfinished">Kompresja: Prosze czekać, jak dotąd wykonano %1 z %2 plików...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="421"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="423"/>
|
||||||
<source>Creating the playlist file, please wait...</source>
|
<source>Creating the playlist file, please wait...</source>
|
||||||
<translation type="unfinished">Tworzenie pliku playlisty, prosze czekać...</translation>
|
<translation type="unfinished">Tworzenie pliku playlisty, prosze czekać...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="431"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="433"/>
|
||||||
<source>Process was aborted by the user after %1 file(s)!</source>
|
<source>Process was aborted by the user after %1 file(s)!</source>
|
||||||
<translation type="unfinished">Proces został przerwany przez użytkownika po wykonaniu %1 plików!</translation>
|
<translation type="unfinished">Proces został przerwany przez użytkownika po wykonaniu %1 plików!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="431"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="433"/>
|
||||||
<source>Process was aborted prematurely by the user!</source>
|
<source>Process was aborted prematurely by the user!</source>
|
||||||
<translation type="unfinished">Proces został przedwcześnie zakończony przez użytkownika!</translation>
|
<translation type="unfinished">Proces został przedwcześnie zakończony przez użytkownika!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="432"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="434"/>
|
||||||
<source>LameXP - Aborted</source>
|
<source>LameXP - Aborted</source>
|
||||||
<translation type="unfinished">LameXP - Przerwano</translation>
|
<translation type="unfinished">LameXP - Przerwano</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="432"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="434"/>
|
||||||
<source>Process was aborted by the user.</source>
|
<source>Process was aborted by the user.</source>
|
||||||
<translation type="unfinished">Proces został przerwany przez użytkownika.</translation>
|
<translation type="unfinished">Proces został przerwany przez użytkownika.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="444"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="446"/>
|
||||||
<source>Error: %1 of %2 files failed. Double-click failed items for detailed information!</source>
|
<source>Error: %1 of %2 files failed. Double-click failed items for detailed information!</source>
|
||||||
<translation type="unfinished">Błąd: %1 z %2 plików nie zostało skompresowanych. Kliknij dwukrotnie na plik aby zobaczyć szczegóły!</translation>
|
<translation type="unfinished">Błąd: %1 z %2 plików nie zostało skompresowanych. Kliknij dwukrotnie na plik aby zobaczyć szczegóły!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="445"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="447"/>
|
||||||
<source>LameXP - Error</source>
|
<source>LameXP - Error</source>
|
||||||
<translation type="unfinished">LameXP - Błąd</translation>
|
<translation type="unfinished">LameXP - Błąd</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="445"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="447"/>
|
||||||
<source>At least one file has failed!</source>
|
<source>At least one file has failed!</source>
|
||||||
<translation type="unfinished">Przynajmniej jeden plik nie został skompresowany!</translation>
|
<translation type="unfinished">Przynajmniej jeden plik nie został skompresowany!</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="455"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="457"/>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="456"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="458"/>
|
||||||
<source>All files completed successfully.</source>
|
<source>All files completed successfully.</source>
|
||||||
<translation type="unfinished">Kompresja wszystkich plików zakończona powodzeniem.</translation>
|
<translation type="unfinished">Kompresja wszystkich plików zakończona powodzeniem.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="456"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="458"/>
|
||||||
<source>LameXP - Done</source>
|
<source>LameXP - Done</source>
|
||||||
<translation type="unfinished">LameXP - Zrobione</translation>
|
<translation type="unfinished">LameXP - Zrobione</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="844"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="846"/>
|
||||||
<source>Playlist creation failed</source>
|
<source>Playlist creation failed</source>
|
||||||
<translation type="unfinished">Tworzenie playlisty zakończone niepowodzeniem</translation>
|
<translation type="unfinished">Tworzenie playlisty zakończone niepowodzeniem</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="844"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="846"/>
|
||||||
<source>The playlist file could not be created:</source>
|
<source>The playlist file could not be created:</source>
|
||||||
<translation type="unfinished">Playlista nie mogła zostać utworzona:</translation>
|
<translation type="unfinished">Playlista nie mogła zostać utworzona:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="914"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="916"/>
|
||||||
<source>Warning: Computer will shutdown in %1 seconds...</source>
|
<source>Warning: Computer will shutdown in %1 seconds...</source>
|
||||||
<translation type="unfinished">Ostrzeżenie: Komputer zostanie zamknięty za %1 sekund/y...</translation>
|
<translation type="unfinished">Ostrzeżenie: Komputer zostanie zamknięty za %1 sekund/y...</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="918"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="920"/>
|
||||||
<location filename="../../src/Dialog_Processing.cpp" line="919"/>
|
<location filename="../../src/Dialog_Processing.cpp" line="921"/>
|
||||||
<source>Cancel Shutdown</source>
|
<source>Cancel Shutdown</source>
|
||||||
<translation type="unfinished">Anuluj wyłączenie komputera</translation>
|
<translation type="unfinished">Anuluj wyłączenie komputera</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -416,7 +416,7 @@
|
|||||||
<enum>QFrame::VLine</enum>
|
<enum>QFrame::VLine</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Sunken</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@ -495,7 +495,7 @@
|
|||||||
<enum>QFrame::VLine</enum>
|
<enum>QFrame::VLine</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Raised</enum>
|
<enum>QFrame::Sunken</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
#define VER_LAMEXP_MINOR_LO 3
|
#define VER_LAMEXP_MINOR_LO 3
|
||||||
#define VER_LAMEXP_TYPE RC
|
#define VER_LAMEXP_TYPE RC
|
||||||
#define VER_LAMEXP_PATCH 3
|
#define VER_LAMEXP_PATCH 3
|
||||||
#define VER_LAMEXP_BUILD 762
|
#define VER_LAMEXP_BUILD 763
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Tools versions
|
// Tools versions
|
||||||
|
@ -244,6 +244,8 @@ ProcessingDialog::~ProcessingDialog(void)
|
|||||||
|
|
||||||
void ProcessingDialog::showEvent(QShowEvent *event)
|
void ProcessingDialog::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
|
static const char *NA = " N/A";
|
||||||
|
|
||||||
setCloseButtonEnabled(false);
|
setCloseButtonEnabled(false);
|
||||||
button_closeDialog->setEnabled(false);
|
button_closeDialog->setEnabled(false);
|
||||||
button_AbortProcess->setEnabled(false);
|
button_AbortProcess->setEnabled(false);
|
||||||
@ -254,9 +256,9 @@ void ProcessingDialog::showEvent(QShowEvent *event)
|
|||||||
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
SetPriorityClass(GetCurrentProcess(), HIGH_PRIORITY_CLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
ramUsageHasChanged(0.0);
|
label_cpu->setText(NA);
|
||||||
cpuUsageHasChanged(0.0);
|
label_disk->setText(NA);
|
||||||
diskUsageHasChanged(0ui64);
|
label_ram->setText(NA);
|
||||||
|
|
||||||
QTimer::singleShot(1000, this, SLOT(initEncoding()));
|
QTimer::singleShot(1000, this, SLOT(initEncoding()));
|
||||||
}
|
}
|
||||||
|
@ -74,63 +74,65 @@ ULONGLONG CPUObserverThread::filetime2ulonglong(const void *ftime)
|
|||||||
|
|
||||||
void CPUObserverThread::observe(void)
|
void CPUObserverThread::observe(void)
|
||||||
{
|
{
|
||||||
ULONGLONG sys[2], usr[2], idl[2];
|
|
||||||
FILETIME sysTime, usrTime, idlTime;
|
|
||||||
QLibrary kernel32("kernel32.dll");
|
QLibrary kernel32("kernel32.dll");
|
||||||
GetSystemTimesPtr getSystemTimes = NULL;
|
GetSystemTimesPtr getSystemTimes = NULL;
|
||||||
bool first = true;
|
|
||||||
double previous = -1.0;
|
|
||||||
|
|
||||||
if(kernel32.load())
|
if(kernel32.load())
|
||||||
{
|
{
|
||||||
getSystemTimes = reinterpret_cast<GetSystemTimesPtr>(kernel32.resolve("GetSystemTimes"));
|
getSystemTimes = reinterpret_cast<GetSystemTimesPtr>(kernel32.resolve("GetSystemTimes"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(getSystemTimes == NULL)
|
if(getSystemTimes != NULL)
|
||||||
{
|
{
|
||||||
qWarning("GetSystemTimes() ist not available on this system!");
|
bool first = true;
|
||||||
return;
|
double previous = -1.0;
|
||||||
}
|
FILETIME sysTime, usrTime, idlTime;
|
||||||
|
ULONGLONG sys[2], usr[2], idl[2];
|
||||||
for(size_t i = 0; i < 2; i++)
|
|
||||||
{
|
|
||||||
sys[i] = 0; usr[i] = 0; idl[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
while(!m_terminated)
|
for(size_t i = 0; i < 2; i++)
|
||||||
{
|
|
||||||
if(getSystemTimes(&idlTime, &sysTime, &usrTime))
|
|
||||||
{
|
{
|
||||||
sys[1] = sys[0]; sys[0] = filetime2ulonglong(&sysTime);
|
sys[i] = 0; usr[i] = 0; idl[i] = 0;
|
||||||
usr[1] = usr[0]; usr[0] = filetime2ulonglong(&usrTime);
|
}
|
||||||
idl[1] = idl[0]; idl[0] = filetime2ulonglong(&idlTime);
|
|
||||||
|
|
||||||
if(first)
|
while(!m_terminated)
|
||||||
|
{
|
||||||
|
if(getSystemTimes(&idlTime, &sysTime, &usrTime))
|
||||||
{
|
{
|
||||||
first = false;
|
sys[1] = sys[0]; sys[0] = filetime2ulonglong(&sysTime);
|
||||||
emit currentUsageChanged(1.0);
|
usr[1] = usr[0]; usr[0] = filetime2ulonglong(&usrTime);
|
||||||
msleep(250);
|
idl[1] = idl[0]; idl[0] = filetime2ulonglong(&idlTime);
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
ULONGLONG timeIdl = (idl[0] - idl[1]); //Idle time only
|
if(first)
|
||||||
ULONGLONG timeSys = (sys[0] - sys[1]); //Kernel mode time (incl. Idle time!)
|
|
||||||
ULONGLONG timeUsr = (usr[0] - usr[1]); //User mode time only
|
|
||||||
|
|
||||||
ULONGLONG timeSum = timeUsr + timeSys; //Overall CPU time that has elapsed
|
|
||||||
ULONGLONG timeWrk = timeSum - timeIdl; //Time the CPU spent working
|
|
||||||
|
|
||||||
if((timeSum > 0) || (timeWrk > 0))
|
|
||||||
{
|
|
||||||
double current = static_cast<double>(timeWrk) / static_cast<double>(timeSum);
|
|
||||||
if(current != previous)
|
|
||||||
{
|
{
|
||||||
emit currentUsageChanged(current);
|
first = false;
|
||||||
previous = current;
|
emit currentUsageChanged(1.0);
|
||||||
|
msleep(250);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONGLONG timeIdl = (idl[0] - idl[1]); //Idle time only
|
||||||
|
ULONGLONG timeSys = (sys[0] - sys[1]); //Kernel mode time (incl. Idle time!)
|
||||||
|
ULONGLONG timeUsr = (usr[0] - usr[1]); //User mode time only
|
||||||
|
|
||||||
|
ULONGLONG timeSum = timeUsr + timeSys; //Overall CPU time that has elapsed
|
||||||
|
ULONGLONG timeWrk = timeSum - timeIdl; //Time the CPU spent working
|
||||||
|
|
||||||
|
if(timeSum > 0)
|
||||||
|
{
|
||||||
|
double current = static_cast<double>(timeWrk) / static_cast<double>(timeSum);
|
||||||
|
if(current != previous)
|
||||||
|
{
|
||||||
|
emit currentUsageChanged(current);
|
||||||
|
previous = current;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
msleep(1000);
|
||||||
}
|
}
|
||||||
msleep(1000);
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("GetSystemTimes() ist not available on this system!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user