Skip to content

Commit

Permalink
webos: ccache_stats.bbclass: Add compile time in ccache_stats.json
Browse files Browse the repository at this point in the history
:Release Notes:
Add do_compile task elapsed time to ccache_stats.json

:Detailed Notes:
In the buildstats.bbclass, the start time of each task is recorded in
the __timedata_task variable by the set_timedata() function at the
beginning of the task.
By using the get_timedata() function of the class, the execution time of
the do_compile task can be retrieved.

Since do_ccache_stats is executed as a postfunc of do_compile, the
elapsedtime is the execution time of the do_compile task.

:Testing Performed:
Build Test Suites.

:QA Notes:
N/A

:Issues Addressed:
[WRQ-28887] CCC: ccache_stats.bbclass: add compile time in
            ccache_stats.json
[WRQ-28864] Add compile time in ccache_stats.json

Cherry-picked-from-commit: 0bcc3a0725a5a4d679c09a2193eb138db36bab11
Cherry-picked-from-branch:
  • Loading branch information
mark.yang authored and ywbyun0815 committed Oct 26, 2024
1 parent 609c362 commit f7ac242
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion meta-webos/classes/ccache_stats.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ CCACHE_STATS = "${TOPDIR}/ccache_stats.json"
CCACHE_STATS[vardepsexclude] = "TOPDIR"

python do_ccache_stats() {
import time
# get_timedata() function is declared in the buildstats.bbclass
elapsedtime = get_timedata("__timedata_task", d, time.time()) or ""
if elapsedtime:
elapsedtime = d.expand("%0.2f seconds" % elapsedtime)

def getHit(stdout: str):
"""
stdout is passed under the form.
Expand Down Expand Up @@ -50,7 +56,7 @@ python do_ccache_stats() {
with open(ccache_stats_json, 'r') as f:
data_json = json.load(f)
with open(ccache_stats_json, 'w') as f:
data_json[pn] = hit_rate
data_json[pn] = "%s, %s" % (hit_rate, elapsedtime)
json.dump(data_json,f,indent='\t',sort_keys=True)
bb.utils.unlockfile(lock)

Expand Down

0 comments on commit f7ac242

Please sign in to comment.