[PATCH phosphor-objmgr v2 09/10] Mapper performance improvements

OpenBMC Patches patches at stwcx.xyz
Fri Nov 6 00:21:49 AEDT 2015


From: Brad Bishop <bradleyb at us.ibm.com>

Don't introspect when calling get_object.
Check for bus name match in signal handlers.
---
 OpenBMCMapper.py |  4 ++--
 phosphor-mapper  | 17 ++++++++++++-----
 2 files changed, 14 insertions(+), 7 deletions(-)

diff --git a/OpenBMCMapper.py b/OpenBMCMapper.py
index ef49637..2bdb110 100644
--- a/OpenBMCMapper.py
+++ b/OpenBMCMapper.py
@@ -132,7 +132,7 @@ class IntrospectionParser:
 
 	def _introspect(self, path):
 		try:
-			obj = self.bus.get_object(self.name, path)
+			obj = self.bus.get_object(self.name, path, introspect = False)
 			iface = dbus.Interface(obj, dbus.BUS_DAEMON_IFACE + '.Introspectable')
 			data = iface.Introspect()
 		except dbus.DBusException:
@@ -344,7 +344,7 @@ class PathTree:
 class Mapper:
 	def __init__(self, bus):
 		self.bus = bus
-		obj = bus.get_object(MAPPER_NAME, MAPPER_PATH)
+		obj = bus.get_object(MAPPER_NAME, MAPPER_PATH, introspect = False)
 		self.iface = dbus.Interface(
 				obj, dbus_interface = MAPPER_IFACE)
 
diff --git a/phosphor-mapper b/phosphor-mapper
index e9aa6dc..36bf09b 100644
--- a/phosphor-mapper
+++ b/phosphor-mapper
@@ -49,11 +49,17 @@ class ObjectMapper(dbus.service.Object):
 			signal_name = 'InterfacesRemoved',
 			sender_keyword = 'sender')
 
+	def bus_match(self, name):
+		if name == OpenBMCMapper.MAPPER_NAME:
+			return False
+		return self.name_match(name)
+
 	def discovery_pending(self):
 		return not bool(self.service)
 
 	def interfaces_added_handler(self, path, iprops, **kw):
-		if self.discovery_pending():
+		if self.discovery_pending() or \
+				not self.bus_match(kw['sender']):
 			return
 		matches = [ x for x in iprops.iterkeys() if self.intf_match(x) ]
 		d = self.cache.setdefault(path, {})
@@ -61,7 +67,8 @@ class ObjectMapper(dbus.service.Object):
 		self.cache[path] = d
 
 	def interfaces_removed_handler(self, path, interfaces, **kw):
-		if self.discovery_pending():
+		if self.discovery_pending() or \
+				not self.bus_match(kw['sender']):
 			return
 		item = self.cache[path]
 		name = kw['sender']
@@ -101,7 +108,7 @@ class ObjectMapper(dbus.service.Object):
 
 	def bus_handler(self, service, old, new):
 		if self.discovery_pending() or \
-				not self.name_match(service):
+				not self.bus_match(service):
 			return
 
 		if new:
@@ -122,7 +129,7 @@ class ObjectMapper(dbus.service.Object):
 		if not owners:
 			owners = [ IntrospectionParser(x, self.bus.dbus,
 				self.tag_match, self.intf_match) \
-						for x in self.bus.get_owner_names(self.name_match) ]
+						for x in self.bus.get_owner_names(self.bus_match) ]
 		for o in owners:
 			self.add_items(o.name, o.introspect())
 
@@ -159,7 +166,7 @@ class BusWrapper:
 	def get_service_names(self, match):
 		# these are well known names
 		return [ x for x in self.dbus.list_names() \
-				if match(x) and x != OpenBMCMapper.MAPPER_NAME ]
+				if match(x) ]
 
 	def get_owner_names(self, match):
 		# these are unique connection names
-- 
2.6.0




More information about the openbmc mailing list