diff --git a/Package.resolved b/Package.resolved index 4ba7be1..484f7fa 100644 --- a/Package.resolved +++ b/Package.resolved @@ -6,7 +6,7 @@ "location" : "https://github.com/OpenSwiftUIProject/OpenGraph", "state" : { "branch" : "main", - "revision" : "6133e9f737077b5c75ff33dee1c2c969cb5d91b4" + "revision" : "45bd9b86eb917e1bd56ead3ef51ca82beca94a70" } }, { diff --git a/Sources/OpenSwiftUI/AppStructure/AppOrganization/Graph/AppGraph.swift b/Sources/OpenSwiftUI/AppStructure/AppOrganization/Graph/AppGraph.swift index 107b10e..e0d489d 100644 --- a/Sources/OpenSwiftUI/AppStructure/AppOrganization/Graph/AppGraph.swift +++ b/Sources/OpenSwiftUI/AppStructure/AppOrganization/Graph/AppGraph.swift @@ -14,6 +14,7 @@ import Glibc #elseif os(WASI) import WASILibc #endif +internal import OpenGraphShims final class AppGraph: GraphHost { static var shared: AppGraph? = nil @@ -21,12 +22,11 @@ final class AppGraph: GraphHost { private struct LaunchProfileOptions: OptionSet { let rawValue: Int32 - - static var enable: LaunchProfileOptions { .init(rawValue: 1 << 1) } + static var profile: LaunchProfileOptions { .init(rawValue: 1 << 1) } } private lazy var launchProfileOptions: LaunchProfileOptions = { - let env = getenv("SWIFTUI_PROFILE_LAUNCH") + let env = getenv("OPENSWIFTUI_PROFILE_LAUNCH") if let env { return .init(rawValue: atoi(env)) } else { @@ -44,9 +44,8 @@ final class AppGraph: GraphHost { guard !didCollectLaunchProfile else { return } - - if launchProfileOptions.contains(.enable) { - // AGGraphStartProfiling + if launchProfileOptions.contains(.profile) { + OGGraph.startProfiling() } } @@ -55,13 +54,12 @@ final class AppGraph: GraphHost { return } didCollectLaunchProfile = true - - if launchProfileOptions.contains(.enable) { - // AGGraphStopProfiling + if launchProfileOptions.contains(.profile) { + OGGraph.stopProfiling() } - - if launchProfileOptions.rawValue != 0 { - // AGGraphArchiveJSON + if !launchProfileOptions.isEmpty { + // /tmp/graph.ag-gzon + OGGraph.archiveJSON(name: nil) } } }