* [PATCH 1/2][Image Creator] Hob Cache for speed up switching
2011-07-11 7:31 [PATCH 0/2][Image Creator] Hob Cache for speed up switching Ke Liping
@ 2011-07-11 7:31 ` Ke Liping
2011-07-11 7:31 ` [PATCH 2/2][Image " Ke Liping
2011-07-20 0:41 ` [PATCH 0/2][Image " Joshua Lock
2 siblings, 0 replies; 6+ messages in thread
From: Ke Liping @ 2011-07-11 7:31 UTC (permalink / raw)
To: yocto
From: Liping Ke <liping.ke@intel.com>
This patch is the centralized place for storing Hob attributes.
Most of informations in Prefs will be used when caching user-select
packages information. Those information will be the cache hash-key
which is useful in deciding whether the configuration combination
value has been cached or not
Signed-off-by: Liping Ke <liping.ke@intel.com>
---
bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 6 +++---
bitbake/lib/bb/ui/crumbs/hobprefs.py | 3 ++-
bitbake/lib/bb/ui/hob.py | 6 ++++--
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index fa79e0c..8c8d9e2 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -99,7 +99,7 @@ class HobHandler(gobject.GObject):
args.extend(argument)
self.server.runCommand(args)
- def handle_event(self, event, running_build, pbar):
+ def handle_event(self, event, running_build, pbar, hobprefs):
if not event:
return
@@ -161,11 +161,11 @@ class HobHandler(gobject.GObject):
pbar.set_fraction(1.0)
return
- def event_handle_idle_func (self, eventHandler, running_build, pbar):
+ def event_handle_idle_func (self, eventHandler, running_build, pbar, hobrefs):
# Consume as many messages as we can in the time available to us
event = eventHandler.getEvent()
while event:
- self.handle_event(event, running_build, pbar)
+ self.handle_event(event, running_build, pbar, hobrefs)
event = eventHandler.getEvent()
return True
diff --git a/bitbake/lib/bb/ui/crumbs/hobprefs.py b/bitbake/lib/bb/ui/crumbs/hobprefs.py
index f186410..05e8170 100644
--- a/bitbake/lib/bb/ui/crumbs/hobprefs.py
+++ b/bitbake/lib/bb/ui/crumbs/hobprefs.py
@@ -143,7 +143,7 @@ class HobPrefs(gtk.Dialog):
glib.idle_add(self.handler.reload_data)
def __init__(self, configurator, handler, curr_sdk_mach, curr_distro, pclass,
- cpu_cnt, pmake, bbthread, image_types):
+ cpu_cnt, pmake, bbthread, image_types, curr_mach):
"""
"""
gtk.Dialog.__init__(self, "Preferences", None,
@@ -159,6 +159,7 @@ class HobPrefs(gtk.Dialog):
self.configurator = configurator
self.curr_sdk_mach = curr_sdk_mach
+ self.curr_mach = curr_mach
self.curr_distro = curr_distro
self.curr_package_format = pclass
self.curr_output_type = None
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py
index 06d936e..76cb294 100644
--- a/bitbake/lib/bb/ui/hob.py
+++ b/bitbake/lib/bb/ui/hob.py
@@ -160,6 +160,7 @@ class MainWindow (gtk.Window):
mach = combo.get_active_text()
if mach != self.curr_mach:
self.curr_mach = mach
+ self.prefs.curr_mach = mach
# Flush this straight to the file as MACHINE is changed
# independently of other 'Preferences'
self.configurator.setLocalConfVar('MACHINE', mach)
@@ -887,7 +888,7 @@ def main (server, eventHandler):
pkg, sep, pclass = pclasses[0].rpartition("_")
prefs = HobPrefs(configurator, handler, sdk_mach, distro, pclass, cpu_cnt,
- pmake, bbthread, image_types)
+ pmake, bbthread, image_types, mach)
layers = LayerEditor(configurator, None)
window = MainWindow(taskmodel, handler, configurator, prefs, layers, mach)
prefs.set_parent_window(window)
@@ -918,7 +919,8 @@ def main (server, eventHandler):
handler.event_handle_idle_func,
eventHandler,
window.build,
- window.progress)
+ window.progress,
+ prefs)
try:
gtk.main()
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread* [PATCH 2/2][Image Creator] Hob Cache for speed up switching
2011-07-11 7:31 [PATCH 0/2][Image Creator] Hob Cache for speed up switching Ke Liping
2011-07-11 7:31 ` [PATCH 1/2][Image " Ke Liping
@ 2011-07-11 7:31 ` Ke Liping
2011-07-20 0:41 ` [PATCH 0/2][Image " Joshua Lock
2 siblings, 0 replies; 6+ messages in thread
From: Ke Liping @ 2011-07-11 7:31 UTC (permalink / raw)
To: yocto
From: Liping Ke <liping.ke@intel.com>
This patch is to cache target dependency tree for Hob (cache impl).
Hob User might switch between different configuration combinations
(machine, sdk-machine, distro, etc). Each dependency re-calcuation
might be time consuming. We use a hashset to cache those result for
avoiding recalc. Thus we can speed up UI data loading speed in
some cases.
Signed-off-by: Liping Ke <liping.ke@intel.com>
---
bitbake/lib/bb/ui/crumbs/hobeventhandler.py | 13 +++++++++++++
bitbake/lib/bb/ui/crumbs/tasklistmodel.py | 5 +++++
bitbake/lib/bb/ui/hob.py | 18 +++++++++++++++++-
3 files changed, 35 insertions(+), 1 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
index 8c8d9e2..c6d3bd5 100644
--- a/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
+++ b/bitbake/lib/bb/ui/crumbs/hobeventhandler.py
@@ -110,6 +110,19 @@ class HobHandler(gobject.GObject):
self.emit("data-generated")
self.generating = False
if event._model:
+ # Currently, use these three property as the key, in the future
+ # more elements might be needed
+ mach = hobprefs.curr_mach
+ if mach == None:
+ mach = ""
+ sdk_mach = hobprefs.curr_sdk_mach
+ if sdk_mach == None:
+ sdk_mach = ""
+ distro = hobprefs.curr_distro
+ if distro == None:
+ distro = ""
+ hash_key = mach + "," + sdk_mach + "," + distro
+ self.model.targetTreeCache[hash_key] = event._model
self.model.populate(event._model)
elif isinstance(event, bb.event.ConfigFilesFound):
var = event._variable
diff --git a/bitbake/lib/bb/ui/crumbs/tasklistmodel.py b/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
index 5e979b7..bcd6328 100644
--- a/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/tasklistmodel.py
@@ -102,6 +102,11 @@ class TaskListModel(gtk.ListStore):
self.packages = None
self.images = None
self.selected_image = None
+ # This var is used for caching target package dependency data. This
+ # data will be impacted by layers, distros, machine, sdk_machine value
+ # which is now all saved in HobPrefs data. For the hashset cache, it's
+ # obvious that the key will be those properties combination.
+ self.targetTreeCache = {}
gtk.ListStore.__init__ (self,
gobject.TYPE_STRING,
diff --git a/bitbake/lib/bb/ui/hob.py b/bitbake/lib/bb/ui/hob.py
index 76cb294..5f6fdf5 100644
--- a/bitbake/lib/bb/ui/hob.py
+++ b/bitbake/lib/bb/ui/hob.py
@@ -166,7 +166,23 @@ class MainWindow (gtk.Window):
self.configurator.setLocalConfVar('MACHINE', mach)
self.configurator.writeLocalConf()
handler.set_machine(mach)
- handler.reload_data()
+ mach = self.prefs.curr_mach
+ if mach == None:
+ mach = ""
+ sdk_mach = self.prefs.curr_sdk_mach
+ if sdk_mach == None:
+ sdk_mach = ""
+ distro = self.prefs.curr_distro
+ if distro == None:
+ distro = ""
+ hash_key = mach + "," + sdk_mach + "," + distro
+ # Only when this target tree has not been cached, need we reload
+ # the target tree data
+ if (self.model.targetTreeCache.has_key(hash_key) == False):
+ handler.reload_data()
+ # Otherwise, simply reload the cache data
+ else:
+ handler.model.populate(self.model.targetTreeCache[hash_key])
def update_machines(self, handler, machines):
active = 0
--
1.7.0.4
^ permalink raw reply related [flat|nested] 6+ messages in thread