summaryrefslogtreecommitdiffstats
path: root/drkonqi/backtrace.cpp
diff options
context:
space:
mode:
authorTimothy Pearson <[email protected]>2013-05-08 16:54:41 -0500
committerTimothy Pearson <[email protected]>2013-05-08 16:54:41 -0500
commit1fbdb78d932e66263f82a1a306b5900cc44b7107 (patch)
treec37bb84ead2546f2ef9054aad05e9b8546785ef2 /drkonqi/backtrace.cpp
parent24e3f6f2fad88b7a3c28f127dff5f02cd41fed99 (diff)
downloadtdebase-1fbdb78d932e66263f82a1a306b5900cc44b7107.tar.gz
tdebase-1fbdb78d932e66263f82a1a306b5900cc44b7107.zip
Update drkonqi to collect data on threaded programs and CPU type/speed/core number
Diffstat (limited to 'drkonqi/backtrace.cpp')
-rw-r--r--drkonqi/backtrace.cpp74
1 files changed, 58 insertions, 16 deletions
diff --git a/drkonqi/backtrace.cpp b/drkonqi/backtrace.cpp
index d7a09c54e..2b349d288 100644
--- a/drkonqi/backtrace.cpp
+++ b/drkonqi/backtrace.cpp
@@ -34,6 +34,7 @@
#include <tdemessagebox.h>
#include <tdelocale.h>
#include <tdetempfile.h>
+#include <tdehardwaredevices.h>
#include "krashconf.h"
#include "backtrace.h"
@@ -201,20 +202,61 @@ bool BackTrace::usefulBacktrace()
// remove stack frames added because of TDECrash
void BackTrace::processBacktrace()
{
- if( !m_krashconf->kcrashRegExp().isEmpty())
- {
- TQRegExp kcrashregexp( m_krashconf->kcrashRegExp());
- int pos = kcrashregexp.search( m_strBt );
- if( pos >= 0 )
- {
- int len = kcrashregexp.matchedLength();
- if( m_strBt[ pos ] == '\n' )
- {
- ++pos;
- --len;
- }
- m_strBt.remove( pos, len );
- m_strBt.insert( pos, TQString::fromLatin1( "[TDECrash handler]\n" ));
- }
- }
+ if( !m_krashconf->kcrashRegExp().isEmpty()) {
+ TQRegExp kcrashregexp( m_krashconf->kcrashRegExp());
+ int pos = -1;
+ while ((pos = kcrashregexp.search( m_strBt )) >= 0) {
+ pos = kcrashregexp.search( m_strBt );
+ if( pos >= 0 ) {
+ int len = kcrashregexp.matchedLength();
+ int nextinfochunkpos = m_strBt.find("====", pos);
+ if (nextinfochunkpos >= 0) {
+ // Trying to delete too much!
+ int chunkpos = pos;
+ TQString limitedstrBt = m_strBt.mid(pos, nextinfochunkpos - pos);
+ pos = kcrashregexp.search( limitedstrBt ) + chunkpos;
+ len = kcrashregexp.matchedLength();
+ }
+ if (pos >= 0) {
+ if( m_strBt[ pos ] == '\n' ) {
+ ++pos;
+ --len;
+ }
+ m_strBt.remove( pos, len );
+ m_strBt.insert( pos, TQString::fromLatin1( "[TDECrash handler]\n" ));
+ }
+ }
+ }
+ }
+ if( !m_krashconf->kcrashRegExpSingle().isEmpty()) {
+ TQRegExp kcrashregexp( m_krashconf->kcrashRegExpSingle());
+ int pos = kcrashregexp.search( m_strBt );
+ if( pos >= 0 ) {
+ int len = kcrashregexp.matchedLength();
+ if( m_strBt[ pos ] == '\n' ) {
+ ++pos;
+ --len;
+ }
+ m_strBt.remove( pos, len );
+ }
+ }
+
+ // Append potentially important hardware information
+ m_strBt.append("\n\n==== (tdehwlib) hardware information ====\n");
+ TDEHardwareDevices *hwdevices = TDEGlobal::hardwareDevices();
+ TDEGenericHardwareList hwlist = hwdevices->listAllPhysicalDevices();
+ TDEGenericDevice *hwdevice;
+ for ( hwdevice = hwlist.first(); hwdevice; hwdevice = hwlist.next() ) {
+ if (hwdevice->type() == TDEGenericDeviceType::CPU) {
+ TDECPUDevice* cpudevice = static_cast<TDECPUDevice*>(hwdevice);
+ m_strBt.append(TQString("CPU core number:\t\t%1\n").arg(cpudevice->coreNumber()));
+ m_strBt.append(TQString("\tVendor:\t\t\t%1\n").arg(cpudevice->vendorName()));
+ m_strBt.append(TQString("\tModel:\t\t\t%1\n").arg(cpudevice->vendorModel()));
+ m_strBt.append(TQString("\tName:\t\t\t%1\n").arg(cpudevice->name()));
+ m_strBt.append(TQString("\tCurrent Frequency:\t%1 MHz\n").arg(cpudevice->frequency()));
+ m_strBt.append(TQString("\tMinimum Frequency:\t%1 MHz\n").arg(cpudevice->minFrequency()));
+ m_strBt.append(TQString("\tMaximum Frequency:\t%1 MHz\n").arg(cpudevice->maxFrequency()));
+ m_strBt.append("\n");
+ }
+ }
}