diff options
| author | ruki <[email protected]> | 2023-03-17 22:36:01 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2023-03-17 22:36:01 +0800 |
| commit | 102d82df48e78f2bc0ef9d8650956c57504a3f1f (patch) | |
| tree | 2e4d5096e0eac0b3ce398393f62dcb95dc9aa728 /xmake/core/sandbox/modules/import | |
| parent | 4d78fc5549b7033096812effcdc33cdb06e2abc2 (diff) | |
trace more tag
Diffstat (limited to 'xmake/core/sandbox/modules/import')
3 files changed, 46 insertions, 0 deletions
diff --git a/xmake/core/sandbox/modules/import/core/base/profiler.lua b/xmake/core/sandbox/modules/import/core/base/profiler.lua new file mode 100644 index 000000000..cd2a42460 --- /dev/null +++ b/xmake/core/sandbox/modules/import/core/base/profiler.lua @@ -0,0 +1,40 @@ +--!A cross-platform build utility based on Lua +-- +-- Licensed under the Apache License, Version 2.0 (the "License"); +-- you may not use this file except in compliance with the License. +-- You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- +-- Copyright (C) 2015-present, TBOOX Open Source Group. +-- +-- @author ruki +-- @file profiler.lua +-- + +-- define module +local sandbox_core_base_profiler = sandbox_core_base_profiler or {} + +-- load modules +local profiler = require("base/profiler") +local raise = require("sandbox/modules/raise") + +-- enter tag +function sandbox_core_base_profiler.enter(name, ...) + profiler:enter(name, ...) +end + +-- leave tag +function sandbox_core_base_profiler.leave(name, ...) + profiler:leave(name, ...) +end + +-- return module +return sandbox_core_base_profiler + diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua index 90dd963fb..0fedf66c7 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_program.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_program.lua @@ -28,6 +28,7 @@ local option = require("base/winos") local table = require("base/table") local utils = require("base/utils") local option = require("base/option") +local profiler = require("base/profiler") local project = require("project/project") local detectcache = require("cache/detectcache") local sandbox = require("sandbox/sandbox") @@ -301,7 +302,9 @@ function sandbox_lib_detect_find_program.main(name, opt) -- find executable program checking = coroutine_running and name or nil + profiler:enter("find_program", name) result = sandbox_lib_detect_find_program._find(name, paths, opt) + profiler:leave("find_program", name) checking = nil -- cache result diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua b/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua index 24e6b97e0..8a048e4fa 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_programver.lua @@ -28,6 +28,7 @@ local table = require("base/table") local utils = require("base/utils") local option = require("base/option") local semver = require("base/semver") +local profiler = require("base/profiler") local project = require("project/project") local detectcache = require("cache/detectcache") local sandbox = require("sandbox/sandbox") @@ -81,6 +82,7 @@ function sandbox_lib_detect_find_programver.main(program, opt) -- attempt to get version output info checking = coroutine_running and program or nil + profiler:enter("find_programver", program) local ok = false local outdata = nil local command = opt.command @@ -93,6 +95,7 @@ function sandbox_lib_detect_find_programver.main(program, opt) ok, outdata = os.iorunv(program, {command or "--version"}, {envs = opt.envs}) end checking = nil + profiler:leave("find_programver", program) -- find version info if ok and outdata and #outdata > 0 then |
