diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-01 11:25:32 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-02-01 18:02:12 +0000 |
commit | 758f18167f2ed50576265a0bab7ec529c69656fa (patch) | |
tree | 792419f4d330faca2cf67c65a4297f2066b55b70 /meta | |
parent | ec3d83f9a90288403b96be25da855fa280aadd8d (diff) | |
download | poky-758f18167f2ed50576265a0bab7ec529c69656fa.tar.gz |
sstate/staging: Batch log messages for performance
According to profile data, repeated calls to bb.debug and bb.note in
the extend_recipe_sysroot() codepath were accounting for 75% of the time
(1.5s) in calls from tasks like do_image_complete.
This batches up the log messages into one call into the logging system
which gives similar behaviour to disabling the logging but retains the
debug information.
Since setscene_depvalid is also called from bitbake's setscene code,
we have to be a little creative with the function parameters and leave
the other debug output mechanism in place. This should hopefully
speed up recipe specific sysroots.
(From OE-Core rev: 3b0af8dc0f796345d1f1ba77ea35bbd090a5feb3)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/sstate.bbclass | 14 | ||||
-rw-r--r-- | meta/classes/staging.bbclass | 11 |
2 files changed, 17 insertions, 8 deletions
diff --git a/meta/classes/sstate.bbclass b/meta/classes/sstate.bbclass index aeb7466d35..ada6fe5986 100644 --- a/meta/classes/sstate.bbclass +++ b/meta/classes/sstate.bbclass | |||
@@ -909,13 +909,19 @@ def sstate_checkhashes(sq_fn, sq_task, sq_hash, sq_hashfn, d, siginfo=False): | |||
909 | 909 | ||
910 | BB_SETSCENE_DEPVALID = "setscene_depvalid" | 910 | BB_SETSCENE_DEPVALID = "setscene_depvalid" |
911 | 911 | ||
912 | def setscene_depvalid(task, taskdependees, notneeded, d): | 912 | def setscene_depvalid(task, taskdependees, notneeded, d, log=None): |
913 | # taskdependees is a dict of tasks which depend on task, each being a 3 item list of [PN, TASKNAME, FILENAME] | 913 | # taskdependees is a dict of tasks which depend on task, each being a 3 item list of [PN, TASKNAME, FILENAME] |
914 | # task is included in taskdependees too | 914 | # task is included in taskdependees too |
915 | # Return - False - We need this dependency | 915 | # Return - False - We need this dependency |
916 | # - True - We can skip this dependency | 916 | # - True - We can skip this dependency |
917 | 917 | ||
918 | bb.debug(2, "Considering setscene task: %s" % (str(taskdependees[task]))) | 918 | def logit(msg, log): |
919 | if log is not None: | ||
920 | log.append(msg) | ||
921 | else: | ||
922 | bb.debug(2, msg) | ||
923 | |||
924 | logit("Considering setscene task: %s" % (str(taskdependees[task])), log) | ||
919 | 925 | ||
920 | def isNativeCross(x): | 926 | def isNativeCross(x): |
921 | return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x or x.endswith("-cross") | 927 | return x.endswith("-native") or "-cross-" in x or "-crosssdk" in x or x.endswith("-cross") |
@@ -933,7 +939,7 @@ def setscene_depvalid(task, taskdependees, notneeded, d): | |||
933 | return True | 939 | return True |
934 | 940 | ||
935 | for dep in taskdependees: | 941 | for dep in taskdependees: |
936 | bb.debug(2, " considering dependency: %s" % (str(taskdependees[dep]))) | 942 | logit(" considering dependency: %s" % (str(taskdependees[dep])), log) |
937 | if task == dep: | 943 | if task == dep: |
938 | continue | 944 | continue |
939 | if dep in notneeded: | 945 | if dep in notneeded: |
@@ -987,7 +993,7 @@ def setscene_depvalid(task, taskdependees, notneeded, d): | |||
987 | 993 | ||
988 | 994 | ||
989 | # Safe fallthrough default | 995 | # Safe fallthrough default |
990 | bb.debug(2, " Default setscene dependency fall through due to dependency: %s" % (str(taskdependees[dep]))) | 996 | logit(" Default setscene dependency fall through due to dependency: %s" % (str(taskdependees[dep])), log) |
991 | return False | 997 | return False |
992 | return True | 998 | return True |
993 | 999 | ||
diff --git a/meta/classes/staging.bbclass b/meta/classes/staging.bbclass index b9c84a4057..35e53fe2b2 100644 --- a/meta/classes/staging.bbclass +++ b/meta/classes/staging.bbclass | |||
@@ -441,6 +441,7 @@ python extend_recipe_sysroot() { | |||
441 | bb.note("Direct dependencies are %s" % str(configuredeps)) | 441 | bb.note("Direct dependencies are %s" % str(configuredeps)) |
442 | #bb.note(" or %s" % str(start)) | 442 | #bb.note(" or %s" % str(start)) |
443 | 443 | ||
444 | msgbuf = [] | ||
444 | # Call into setscene_depvalid for each sub-dependency and only copy sysroot files | 445 | # Call into setscene_depvalid for each sub-dependency and only copy sysroot files |
445 | # for ones that would be restored from sstate. | 446 | # for ones that would be restored from sstate. |
446 | done = list(start) | 447 | done = list(start) |
@@ -455,19 +456,21 @@ python extend_recipe_sysroot() { | |||
455 | taskdeps = {} | 456 | taskdeps = {} |
456 | taskdeps[dep] = setscenedeps[dep][:2] | 457 | taskdeps[dep] = setscenedeps[dep][:2] |
457 | taskdeps[datadep] = setscenedeps[datadep][:2] | 458 | taskdeps[datadep] = setscenedeps[datadep][:2] |
458 | retval = setscene_depvalid(datadep, taskdeps, [], d) | 459 | retval = setscene_depvalid(datadep, taskdeps, [], d, msgbuf) |
459 | if retval: | 460 | if retval: |
460 | bb.note("Skipping setscene dependency %s for installation into the sysroot" % datadep) | 461 | msgbuf.append("Skipping setscene dependency %s for installation into the sysroot") |
461 | continue | 462 | continue |
462 | done.append(datadep) | 463 | done.append(datadep) |
463 | new.append(datadep) | 464 | new.append(datadep) |
464 | if datadep not in configuredeps and setscenedeps[datadep][1] == "do_populate_sysroot": | 465 | if datadep not in configuredeps and setscenedeps[datadep][1] == "do_populate_sysroot": |
465 | configuredeps.append(datadep) | 466 | configuredeps.append(datadep) |
466 | bb.note("Adding dependency on %s" % setscenedeps[datadep][0]) | 467 | msgbuf.append("Adding dependency on %s" % setscenedeps[datadep][0]) |
467 | else: | 468 | else: |
468 | bb.note("Following dependency on %s" % setscenedeps[datadep][0]) | 469 | msgbuf.append("Following dependency on %s" % setscenedeps[datadep][0]) |
469 | next = new | 470 | next = new |
470 | 471 | ||
472 | bb.note("\n".join(msgbuf)) | ||
473 | |||
471 | stagingdir = d.getVar("STAGING_DIR") | 474 | stagingdir = d.getVar("STAGING_DIR") |
472 | recipesysroot = d.getVar("RECIPE_SYSROOT") | 475 | recipesysroot = d.getVar("RECIPE_SYSROOT") |
473 | recipesysrootnative = d.getVar("RECIPE_SYSROOT_NATIVE") | 476 | recipesysrootnative = d.getVar("RECIPE_SYSROOT_NATIVE") |