Sophie

Sophie

distrib > Fedora > 13 > i386 > media > updates-src > by-pkgid > 30b186dc3cb288aca383fd70c35a938e > files > 9

CodeAnalyst-gui-2.8.54-23.fc13.src.rpm

diff -paurN CodeAnalyst-gui-2.8.54/src/ca/gui/application.cpp CodeAnalyst-gui-2.8.54-user-dynamic-feature-check/src/ca/gui/application.cpp
--- CodeAnalyst-gui-2.8.54/src/ca/gui/application.cpp	2009-06-18 06:54:47.000000000 -0500
+++ CodeAnalyst-gui-2.8.54-user-dynamic-feature-check/src/ca/gui/application.cpp	2009-07-29 10:27:48.000000000 -0500
@@ -863,7 +863,7 @@ void ApplicationWindow::onSamplingStart 
 			return;
 		}
 
-		if (!m_opIf.checkIbsSupportInDaemon())
+		if (m_opIf.checkIbsSupportInDaemon() < 0 )
 		{
 			QMessageBox::critical (this, "CodeAnalyst Error",
 				QString("Current OProfile daemon does not supported IBS profile\n")
@@ -1482,14 +1482,15 @@ void ApplicationWindow:: enumerateAllIbs
 		if (pIbsSession->opSample && (*ev_it).op_name.contains("IBS_OP_")) {
 			bypass = false;
 			QString t = QString::number(pIbsSession->opInterval, 10);
-#if (OPD_NO_DISPATCH_OP_OPTION == 1)
-			op_name = QString("event:") + (*ev_it).op_name + 
-				" count:" + t + " unit-mask:0";
-#else
-			op_name = QString("event:") + (*ev_it).op_name + 
-				" count:" + t + " unit-mask:" 
-				+ ((pIbsSession->opCycleCount)? "0" : "1") ;
-#endif
+			
+			if (m_opIf.checkDispatchOpInDaemon() > 0) {
+				op_name = QString("event:") + (*ev_it).op_name + 
+					" count:" + t + " unit-mask:" 
+					+ ((pIbsSession->opCycleCount)? "0" : "1") ;
+			} else {
+				op_name = QString("event:") + (*ev_it).op_name + 
+					" count:" + t + " unit-mask:0";
+			}
 		}
 
 		if (bypass)
@@ -1506,13 +1507,12 @@ void ApplicationWindow:: enumerateAllIbs
 			if (pIbsSession->fetchSample 
 			&&  (*ev_it).op_name.contains("IBS_FETCH_")) 
 			{
-#if (OP_VERSION_BASE >= 0x00905)
-				// If specify list and not found
-				if (pIbsSession->fetchList.size() != 0
-				&&  pIbsSession->fetchList.find((*ev_it).value) == pIbsSession->fetchList.end())
-					continue;
-#endif
-
+				if (m_opIf.checkIbsSupportInDaemon() >= 2) {
+					// If specify list and not found
+					if (pIbsSession->fetchList.size() != 0
+					&&  pIbsSession->fetchList.find((*ev_it).value) == pIbsSession->fetchList.end())
+						continue;
+				}
 
 				eet.eventCount = pIbsSession->fetchInterval; 
 				eet.eventMask = (*ev_it).value;
@@ -1524,13 +1524,12 @@ void ApplicationWindow:: enumerateAllIbs
 			if (pIbsSession->opSample 
 			&& (*ev_it).op_name.contains("IBS_OP_")) 
 			{
-#if (OP_VERSION_BASE >= 0x00905)
-				// If specify list and not found
-				if (pIbsSession->opList.size() != 0
-				&&  pIbsSession->opList.find((*ev_it).value) == pIbsSession->opList.end())
-					continue;						
-#endif
-
+				if (m_opIf.checkIbsSupportInDaemon() >= 2) {
+					// If specify list and not found
+					if (pIbsSession->opList.size() != 0
+					&&  pIbsSession->opList.find((*ev_it).value) == pIbsSession->opList.end())
+						continue;						
+				}
 
 				eet.eventCount = pIbsSession->opInterval; 
 				eet.eventMask = EncodeEventMask((*ev_it).value,
@@ -2911,64 +2910,64 @@ bool ApplicationWindow::runIbs ()
 			ibs_prop.dispatched_ops = 1;
 	}
 
-#if (OP_VERSION_BASE >= 0x00905)
-	// NOTE: If the fetchList or opList is empty while it is being enabled, 
-	//       we would add all fetch/op events to the list. 
-	//       This would help keep the old IBS DCCOnfig compatible.
-	bool fixFetchList = false;
-	bool fixOpList    = false;
-
-	if (pIbsSession->fetchSample && pIbsSession->fetchList.size() == 0 )
-		fixFetchList = true;	
-
-	if (pIbsSession->opSample && pIbsSession->opList.size() == 0 )
-		fixOpList = true;	
-
-	if (fixFetchList || fixOpList) {
-		EventList evList;
-		m_eventFile.findIbsEvent(evList);
-
-		EventList::iterator ev_it = evList.begin();	
-		EventList::iterator ev_end = evList.end();	
-		for(;ev_it != ev_end; ev_it++) {
-			if (0xF000 <= (*ev_it).value && (*ev_it).value < 0xF100 && fixFetchList) {
-				//fetch
-				pIbsSession->fetchList.append((*ev_it).value);
-			} else if (0xF100 <= (*ev_it).value && fixOpList) {
-				//op
-				pIbsSession->opList.append((*ev_it).value);
+	if (m_opIf.checkIbsSupportInDaemon() >= 2) {
+		// NOTE: If the fetchList or opList is empty while it is being enabled, 
+		//       we would add all fetch/op events to the list. 
+		//       This would help keep the old IBS DCCOnfig compatible.
+		bool fixFetchList = false;
+		bool fixOpList    = false;
+
+		if (pIbsSession->fetchSample && pIbsSession->fetchList.size() == 0 )
+			fixFetchList = true;	
+
+		if (pIbsSession->opSample && pIbsSession->opList.size() == 0 )
+			fixOpList = true;	
+
+		if (fixFetchList || fixOpList) {
+			EventList evList;
+			m_eventFile.findIbsEvent(evList);
+
+			EventList::iterator ev_it = evList.begin();	
+			EventList::iterator ev_end = evList.end();	
+			for(;ev_it != ev_end; ev_it++) {
+				if (0xF000 <= (*ev_it).value && (*ev_it).value < 0xF100 && fixFetchList) {
+					//fetch
+					pIbsSession->fetchList.append((*ev_it).value);
+				} else if (0xF100 <= (*ev_it).value && fixOpList) {
+					//op
+					pIbsSession->opList.append((*ev_it).value);
+				}
 			}
-		}
-	} 
+		} 
+
+		// Convert list of IBS Fetch event number to op-name for oprofiled
+		QValueList<unsigned int>::iterator it     = pIbsSession->fetchList.begin();
+		QValueList<unsigned int>::iterator it_end = pIbsSession->fetchList.end();
+		for (; it != it_end; it++)
+		{
+			CpuEvent event;
+			m_eventFile.findEventByValue(*it, event);
 
-	// Convert list of IBS Fetch event number to op-name for oprofiled
-	QValueList<unsigned int>::iterator it     = pIbsSession->fetchList.begin();
-	QValueList<unsigned int>::iterator it_end = pIbsSession->fetchList.end();
-	for (; it != it_end; it++)
-	{
-		CpuEvent event;
-		m_eventFile.findEventByValue(*it, event);
-
-		if (0xF000 <= *it && *it < 0xF100) {
-			//fetch
-			ibs_prop.fetch_strList.append(event.op_name);
+			if (0xF000 <= *it && *it < 0xF100) {
+				//fetch
+				ibs_prop.fetch_strList.append(event.op_name);
+			}
 		}
-	}
-	
-	// Convert list of IBS Op event number to op-name for oprofiled
-	it     = pIbsSession->opList.begin();
-	it_end = pIbsSession->opList.end();
-	for (; it != it_end; it++)
-	{
-		CpuEvent event;
-		m_eventFile.findEventByValue(*it, event);
+		
+		// Convert list of IBS Op event number to op-name for oprofiled
+		it     = pIbsSession->opList.begin();
+		it_end = pIbsSession->opList.end();
+		for (; it != it_end; it++)
+		{
+			CpuEvent event;
+			m_eventFile.findEventByValue(*it, event);
 
-		if (0xF100 <= *it) {
-			//op
-			ibs_prop.op_strList.append(event.op_name);
+			if (0xF100 <= *it) {
+				//op
+				ibs_prop.op_strList.append(event.op_name);
+			}
 		}
 	}
-#endif
 
 	ibs_prop.dcMissInfoEnabled = pIbsSession->dcMissInfoEnabled;
 
diff -paurN CodeAnalyst-gui-2.8.54/src/ca/gui/CfgIbs.cpp CodeAnalyst-gui-2.8.54-user-dynamic-feature-check/src/ca/gui/CfgIbs.cpp
--- CodeAnalyst-gui-2.8.54/src/ca/gui/CfgIbs.cpp	2009-06-23 16:41:21.000000000 -0500
+++ CodeAnalyst-gui-2.8.54-user-dynamic-feature-check/src/ca/gui/CfgIbs.cpp	2009-07-29 10:27:48.000000000 -0500
@@ -21,6 +21,7 @@
 #include "CfgIbs.h"
 #include "iruncontrol.h"
 #include "atuneoptions.h"
+#include "oprofile_interface.h"
 #include <qbuttongroup.h>
 #include "xp.h"
 
@@ -213,11 +214,11 @@ void IbsCfgDlg::setProfile (ProfileColle
 	m_pOpInterval->setText (QString::number (ibsOptions.opInterval));
 	m_pOp->setChecked (ibsOptions.opSample);
 
-#if (OPD_NO_DCMISSINFO_OPTION == 0)
-	m_pDcMissInfoEnabled->setChecked (ibsOptions.dcMissInfoEnabled);
-#else
-	m_pDcMissInfoEnabled->hide();
-#endif
+	oprofile_interface opIf;
+	if (opIf.checkDCMissInfoInDaemon() > 0) 
+		m_pDcMissInfoEnabled->setChecked (ibsOptions.dcMissInfoEnabled);
+	else
+		m_pDcMissInfoEnabled->hide();
 
 	// Check REV C support
 	char VendorId[15];
@@ -242,24 +243,24 @@ void IbsCfgDlg::setProfile (ProfileColle
 		m_pOpDispatch->setChecked (false);
 	}
 
-#if (OP_VERSION_BASE >= 0x00905)
-	// Load events to IBS Fetch List
-	QString file = helpGetEventFile(Family, Model);
-	if( !m_eventsFile.open (file) )
-	{
-		QMessageBox::information( this, "Error", 
-			"Unable to open the events file: " + file);
-	}
-	addIbsEventFromFileToList(Model);
+	if (opIf.checkIbsSupportInDaemon() >= 2) {
+		// Load events to IBS Fetch List
+		QString file = helpGetEventFile(Family, Model);
+		if( !m_eventsFile.open (file) )
+		{
+			QMessageBox::information( this, "Error", 
+				"Unable to open the events file: " + file);
+		}
+		addIbsEventFromFileToList(Model);
 
-	selectIbsEvents(&ibsOptions);
-#else
-	m_pFetchList->hide();
-	m_pSelectAllFetch->hide();
-	m_pOpList->hide();
-	m_pSelectAllOp->hide();
-	this->resize(0,0);
-#endif
+		selectIbsEvents(&ibsOptions);
+	} else {
+		m_pFetchList->hide();
+		m_pSelectAllFetch->hide();
+		m_pOpList->hide();
+		m_pSelectAllOp->hide();
+		this->resize(0,0);
+	}
 	
 	m_pLaunchBox->hide();
 	m_modified = false;
diff -paurN CodeAnalyst-gui-2.8.54/src/ca/gui/oprofile_interface.cpp CodeAnalyst-gui-2.8.54-user-dynamic-feature-check/src/ca/gui/oprofile_interface.cpp
--- CodeAnalyst-gui-2.8.54/src/ca/gui/oprofile_interface.cpp	2009-07-29 10:28:41.000000000 -0500
+++ CodeAnalyst-gui-2.8.54-user-dynamic-feature-check/src/ca/gui/oprofile_interface.cpp	2009-07-29 10:27:48.000000000 -0500
@@ -71,6 +71,9 @@ oprofile_interface::oprofile_interface (
 	m_isDaemonStarted = false;
 	m_daemon_pid = 0;
 	m_numEventCountersAvailable = 0;
+	m_ibsVersion = 0;
+	m_hasDispatchOpInDaemon = 0;
+	m_hasDCMissInfoInDaemon = 0;
 	
 	CA_OPROFILE_CONTROLLER  = simplifyPath(CA_OPROFILE_CONTROLLER);
 }
@@ -290,63 +293,62 @@ int oprofile_interface::help_start_daemo
 		opd_args.append (event_args);
 	}
 
-	//********************************************************
-#if (OP_VERSION_BASE >= 0x00905)
-	// IBS2 stuff
-	// --ext-feature=ibs:fetch:ev1,ev2,...,evN:fetch_count:fetch_um|op:ev1,ev2,...,evN:op_count:op_um
-
-	buf = "";
-	if( (active_profiling & OP_IBS_FETCH)
-	||  (active_profiling & OP_IBS_OP))
-		opd_args.append("--ext-feature=ibs:");
-
-	if (active_profiling & OP_IBS_FETCH) {
-		buf = QString("fetch:") +
-			m_pIbsProperties->fetch_strList.join(",") + ":" +
-			QString::number(m_pIbsProperties->fetch_count) + ":" +
-			QString::number(m_pIbsProperties->fetch_um);
-	} 
-
-	if (active_profiling & OP_IBS_OP) {
-		if (active_profiling & OP_IBS_FETCH) 
-		buf = buf + QString("\\|");
-
-		buf = buf + QString("op:") +
-			m_pIbsProperties->op_strList.join(",") + ":" +
-			QString::number(m_pIbsProperties->op_count) + ":" +
-			QString::number(m_pIbsProperties->op_um);
-	}
-	opd_args.append (buf);
+	if (checkIbsSupportInDaemon() == 2) {
+		//********************************************************
+		// IBS2 stuff
+		// --ext-feature=ibs:fetch:ev1,ev2,...,evN:fetch_count:fetch_um|op:ev1,ev2,...,evN:op_count:op_um
+
+		buf = "";
+		if( (active_profiling & OP_IBS_FETCH)
+		||  (active_profiling & OP_IBS_OP))
+			opd_args.append("--ext-feature=ibs:");
 
-#else //(OP_VERSION_BASE >= 0x00905)
+		if (active_profiling & OP_IBS_FETCH) {
+			buf = QString("fetch:") +
+				m_pIbsProperties->fetch_strList.join(",") + ":" +
+				QString::number(m_pIbsProperties->fetch_count) + ":" +
+				QString::number(m_pIbsProperties->fetch_um);
+		} 
 
-	// IBS1 stuff
-	buf = "";
-	if( (active_profiling & OP_IBS_FETCH)
-	||  (active_profiling & OP_IBS_OP))
-		opd_args.append("--events= ");
+		if (active_profiling & OP_IBS_OP) {
+			if (active_profiling & OP_IBS_FETCH) 
+			buf = buf + QString("\\|");
 
-	if (active_profiling & OP_IBS_FETCH) {
-		buf.sprintf("--ibs-fetch=%ld ", m_pIbsProperties->fetch_count);
+			buf = buf + QString("op:") +
+				m_pIbsProperties->op_strList.join(",") + ":" +
+				QString::number(m_pIbsProperties->op_count) + ":" +
+				QString::number(m_pIbsProperties->op_um);
+		}
 		opd_args.append (buf);
-	} 
+	}
+	else if (checkIbsSupportInDaemon() == 1) {
+		// IBS1 stuff
+		buf = "";
+		if( (active_profiling & OP_IBS_FETCH)
+		||  (active_profiling & OP_IBS_OP))
+			opd_args.append("--events= ");
 
-	if (active_profiling & OP_IBS_OP) {
-		buf.sprintf("--ibs-op=%ld ", m_pIbsProperties->op_count);
-		opd_args.append (buf);
+		if (active_profiling & OP_IBS_FETCH) {
+			buf.sprintf("--ibs-fetch=%ld ", m_pIbsProperties->fetch_count);
+			opd_args.append (buf);
+		} 
 
-#if (OPD_NO_DISPATCH_OP_OPTION == 0)
-		if(m_pIbsProperties->dispatched_ops)
-			opd_args.append ("--ibs-op-dispatch-op ");
-#endif
-		
-#if (OPD_NO_DCMISSINFO_OPTION == 0)
-		if(m_pIbsProperties->dcMissInfoEnabled)
-			opd_args.append ("--ibs-op-dcmissinfo-enable ");
-#endif
+		if (active_profiling & OP_IBS_OP) {
+			buf.sprintf("--ibs-op=%ld ", m_pIbsProperties->op_count);
+			opd_args.append (buf);
+
+		if (checkDispatchOpInDaemon() > 0) {
+			if(m_pIbsProperties->dispatched_ops)
+				opd_args.append ("--ibs-op-dispatch-op ");
+		}
+			
+		if (checkDCMissInfoInDaemon() > 0) {
+			if(m_pIbsProperties->dcMissInfoEnabled)
+				opd_args.append ("--ibs-op-dcmissinfo-enable ");
+		}
 
+		}
 	}
-#endif //(OP_VERSION_BASE >= 0x00905)
 
 	// END CMD LINE APPENDING.
 
@@ -1137,29 +1139,84 @@ bool oprofile_interface::havePermissionT
 }
 
 
-bool oprofile_interface::checkIbsSupportInDaemon()
+int oprofile_interface::checkIbsSupportInDaemon()
 {
-	bool ret = false;
 	QString command;
+
+	if (m_ibsVersion != 0)
+		goto out;
 	
-#if (OP_VERSION_BASE == 0x00903)
+	// CA-OProfile-0.9.3
 	command = QString(OP_BINDIR) +
 			"/opcontrol --help 2>&1 " +
 			"| grep ibs-fetch 2> /dev/null > /dev/null";
 	
-	ret = (system(command.ascii()) == 0)? true: false;
-#endif
+	if (system(command.ascii()) == 0) {
+		m_ibsVersion = 1;
+		goto out;
+	}
 
-#if (OP_VERSION_BASE >= 0x00905)
-	
+	// OProfile-0.9.5
 	command = QString(OP_BINDIR) +
 			"/oprofiled --help 2>&1 " +
 			"| grep ext-feature 2> /dev/null > /dev/null";
-	ret = (system(command.ascii()) == 0)? true: false;
-#endif
-	return ret;
+	if (system(command.ascii()) == 0) {
+		m_ibsVersion = 2;
+		goto out;
+	}
+	
+	m_ibsVersion = -1;
+out:
+	return m_ibsVersion;
 }
 
+
+int oprofile_interface::checkDispatchOpInDaemon()
+{
+	bool ret = false;
+	QString command;
+
+	if (m_hasDispatchOpInDaemon != 0)
+		goto out;
+	
+	// CA-OProfile-0.9.3
+	command = QString(OP_BINDIR) +
+			"/opcontrol --help 2>&1 " +
+			"| grep ibs-op-dispatch-op 2> /dev/null > /dev/null";
+	
+	ret =  (system(command.ascii()) == 0)? true: false;
+	if (ret)
+		m_hasDispatchOpInDaemon = 1;
+	else
+		m_hasDispatchOpInDaemon = -1;
+out:
+	return m_hasDispatchOpInDaemon;
+}
+
+
+int oprofile_interface::checkDCMissInfoInDaemon() 
+{
+	bool ret = false;
+	QString command;
+	
+	if (m_hasDCMissInfoInDaemon != 0)
+		goto out;
+	
+	// CA-OProfile-0.9.3
+	command = QString(OP_BINDIR) +
+			"/opcontrol --help 2>&1 " +
+			"| grep ibs-op-dcmissinfo-enable 2> /dev/null > /dev/null";
+	
+	ret =  (system(command.ascii()) == 0)? true: false;
+	if (ret)
+		m_hasDCMissInfoInDaemon = 1;
+	else 
+		m_hasDCMissInfoInDaemon = -1;
+out:
+	return m_hasDCMissInfoInDaemon;
+}
+
+
 bool oprofile_interface::checkMuxSupportInDaemon()
 {
 	// NOTE: This check allows only the CodeAnalyst Oprofile
diff -paurN CodeAnalyst-gui-2.8.54/src/ca/gui/oprofile_interface.h CodeAnalyst-gui-2.8.54-user-dynamic-feature-check/src/ca/gui/oprofile_interface.h
--- CodeAnalyst-gui-2.8.54/src/ca/gui/oprofile_interface.h	2009-06-10 15:45:23.000000000 -0500
+++ CodeAnalyst-gui-2.8.54-user-dynamic-feature-check/src/ca/gui/oprofile_interface.h	2009-07-29 10:27:48.000000000 -0500
@@ -94,7 +94,11 @@ public:
 	
 	bool codeanalyst_service_status();
 
-	bool checkIbsSupportInDaemon();
+	int checkIbsSupportInDaemon();
+
+	int checkDispatchOpInDaemon();
+
+	int checkDCMissInfoInDaemon();
 	
 	bool checkMuxSupportInDaemon();
 
@@ -134,19 +138,18 @@ private:
 	QString simplifyPath(QString path);
 
 private:
-	op_ibs_property * m_pIbsProperties;
-
-	op_event_property m_EventProperties[MAX_EVENTNUM_MULTIPLEXING];
-
-	QProcess * m_proc;
-
-	QString m_StdErr;
-	QString m_StdOut;
+	QProcess 		* m_proc;
+	op_ibs_property 	* m_pIbsProperties;
+	op_event_property 	m_EventProperties[MAX_EVENTNUM_MULTIPLEXING];
+	QString 		m_StdErr;
+	QString 		m_StdOut;
+	int 			m_numEventCountersAvailable;
+	bool 			m_isDaemonStarted;
+	unsigned int 		m_daemon_pid;
+	int			m_ibsVersion;
+	int			m_hasDispatchOpInDaemon;
+	int			m_hasDCMissInfoInDaemon;
 	
-	int m_numEventCountersAvailable;
-
-	bool m_isDaemonStarted;
-	unsigned int m_daemon_pid;
 };
 
 #endif