How openharmony/hiviewdfx_hiview works
Main Components
• Adapter Layer – This is the operating system adaptation layer (seen under “adapter” and “adapter/service”). It contains code that adapts the system service APIs (e.g., HiSysEvent API) to Hiview’s internal interfaces.
• Base Module – Under “base”, this provides core definitions, utility classes, and common declarations. It includes event definitions, logging, basic event processing utilities, and helper functions.
• Core Module – Found under “core”, “interfaces”, and parts of “framework” directories, this module manages plug‐in configurations and is responsible for event dispatch, collection, and coordination.
• Service – Under “service”, it provides platform services, for example, the run-information exporting functions.
• Plugins – The “plugins” directory is extensive and consists of independent service modules (for example, eventlogger, faultlogger, freeze_detector, performance, unified_collector, etc.). These plug-ins extend the functionality, handling specific types of events, performing logging, analysis, or providing specialized monitoring capabilities.
• Utility and Testing Components – There are various directories (like “utility”, “test”, and “build”) that show support for testing, configuration, and build automation.
Representing Interactions and Data Flow
• HiSysEventSource (a part of the event source subsystem/code in base or plugins) which reads and logs these events.
• The Adapter layer then translates these events into the internal format consumed by the Base module.
• From there, the Core module picks up the formatted events and dispatches them to the appropriate Plug-in modules.
• The Service layer then aggregates or formats output data (for example, exporting run-information) that could be reported back to other OpenHarmony subsystems.
Architectural Patterns
• Event-Driven Architecture: Emphasize that the system uses a centralized event bus (or stubs) to capture and process events.
• Plug-in Management and Dynamic Loading: Note that plugins are modular and can be independently developed, tested, and loaded based on configuration.
• OS Adaptation Layer: The Adapter wraps differences between operating system APIs and the Hiview internal APIs, making the module portable across different hardware platforms.