Linux system power consumption analysis method, device, system and medium
Patent Information
- Application Number
- CN202611089440.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-22
- Publication Date
- 2026-10-16
AI Technical Summary
[0005]本发明实施例提供了一种Linux系统功耗分析方法、装置、终端及存储介质,以解决现有技术中对于Linux系统功耗分析准确性较低的技术问题
[0010]The Linux system power consumption analysis method, device, terminal, and storage medium provided in this invention collect multi-dimensional indicators of the Linux system's operating status, including logical operation load, storage interaction throughput, and data transmission load. Based on these multi-dimensional indicators, corresponding resource occupancy time-series sequences are constructed using the same time-series marker. Energy consumption monitoring data is collected synchronously, and the multi-dimensional indicators are correlated and matched with the energy consumption monitoring data using a time-series mapping strategy based on the same time-series marker. Abnormal energy consumption fluctuation intervals are identified based on the collected energy consumption monitoring data, and resource occupancy time-series sequences of each dimension within the abnormal intervals are extracted. Based on the resource occupancy time-series sequences within the abnormal intervals, the key influencing entities causing the energy consumption anomalies are analyzed. This method can automatically filter out a large amount of normal steady-state operating data, directly pinpointing the key time segments where power consumption anomalies occur, converging the analysis object from full-time-axis data to limited data within the abnormal intervals, greatly reducing data processing volume and improving fault location efficiency. By using a time-series mapping strategy based on the same time-series marker to associate and match the multi-dimensional indicators of the operating state with the energy consumption monitoring data, each energy consumption value can be accurately mapped to the system operating state at that time. This establishes a direct causal link between system behavior and energy consumption consequences, providing a data foundation for subsequent accurate analysis of the causes of power consumption anomalies and significantly improving the accuracy of power consumption attribution. Furthermore, the use of multi-dimensional process-level energy consumption attribution improves the accuracy of anomaly localization.
Smart Images

Figure CN122925147A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power consumption analysis technology, and in particular to a power consumption analysis method, apparatus, system, and storage medium for Linux systems. Background Technology
[0002] With the widespread application of domestically developed operating systems (such as Kylin OS) in mobile computing devices such as laptops, energy management and battery life have increasingly become core indicators of concern for users. During the research and development and actual deployment of operating systems, abnormally high power consumption often occurs, which not only shortens battery life but also causes problems such as overheating and slow system response.
[0003] The causes of abnormal power consumption in Linux systems are quite complex. In addition to common issues such as abnormal CPU utilization and frequent disk I / O, excessive network transmission and reception by processes can also significantly increase system power consumption. Therefore, it is necessary to attribute the cause of the increased system power consumption.
[0004] In the process of developing this invention, the inventors discovered the following technical problems: Existing system monitoring tools can only collect operational indicators such as CPU and I / O, while power consumption meters and other devices can only collect the overall power consumption of the machine. Because these two types of data come from different sources, have different collection frequencies, and lack a unified time-series marker, the data cannot be accurately aligned on the timeline, making it difficult to determine which specific process behavior caused the power consumption fluctuations during a specific time period, and thus impossible to establish a causal relationship between process behavior and increased power consumption. Furthermore, there is often a lack of process-level detailed statistical and ranking analysis functions for key indicators such as I / O and network. When system power consumption increases, it is difficult to quickly pinpoint the specific process entity causing the high power consumption from among numerous processes, requiring manual investigation, which is inefficient and lacks accuracy. Summary of the Invention
[0005] This invention provides a method, apparatus, terminal, and storage medium for analyzing power consumption in Linux systems, in order to solve the technical problem of low accuracy in power consumption analysis of Linux systems in the prior art.
[0006] In a first aspect, embodiments of the present invention provide a method for power consumption analysis of a Linux system, including: Collect multi-dimensional metrics of Linux system operation status, including: logical operation load, storage interaction throughput, and data transmission load. Based on the multidimensional indicators of the operating status, corresponding resource occupancy time series are constructed respectively based on the same time series marker; Energy consumption monitoring data is collected synchronously, and the multi-dimensional indicators of the operating status are associated and matched with the energy consumption monitoring data based on the same time series marker using a time series mapping strategy; Based on the collected energy consumption monitoring data, identify abnormal energy consumption fluctuation intervals and extract the time series sequence of resource occupancy in each dimension within the abnormal intervals; Based on the time-series sequence of resource usage within the abnormal interval, the key influencing entities that cause abnormal energy consumption are analyzed.
[0007] Secondly, embodiments of the present invention also provide a Linux system power consumption analysis device, comprising: The data acquisition module is used to collect multi-dimensional indicators of the Linux system's operating status, including: logical operation load, storage interaction throughput, and data transmission load. The construction module is used to construct corresponding resource occupancy time series based on the same time series marker according to the multi-dimensional indicators of the running status; The matching module is used to synchronously collect energy consumption monitoring data and, based on the same time series marker, use a time series mapping strategy to associate and match the multi-dimensional indicators of the operating status with the energy consumption monitoring data. The extraction module is used to identify abnormal energy consumption fluctuation intervals based on the collected energy consumption monitoring data, and extract the time series sequence of resource occupancy in each dimension within the abnormal interval; The parsing module is used to analyze the key entities that cause abnormal energy consumption based on the resource usage time sequence within the abnormal interval.
[0008] Thirdly, embodiments of the present invention also provide a terminal, including: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the Linux system power consumption analysis method as described in any of the above embodiments.
[0009] Fourthly, embodiments of the present invention also provide a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the Linux system power consumption analysis method provided in the above embodiments.
[0010] The Linux system power consumption analysis method, device, terminal, and storage medium provided in this invention collect multi-dimensional indicators of the Linux system's operating status, including logical operation load, storage interaction throughput, and data transmission load. Based on these multi-dimensional indicators, corresponding resource occupancy time-series sequences are constructed using the same time-series marker. Energy consumption monitoring data is collected synchronously, and the multi-dimensional indicators are correlated and matched with the energy consumption monitoring data using a time-series mapping strategy based on the same time-series marker. Abnormal energy consumption fluctuation intervals are identified based on the collected energy consumption monitoring data, and resource occupancy time-series sequences of each dimension within the abnormal intervals are extracted. Based on the resource occupancy time-series sequences within the abnormal intervals, the key influencing entities causing the energy consumption anomalies are analyzed. This method can automatically filter out a large amount of normal steady-state operating data, directly pinpointing the key time segments where power consumption anomalies occur, converging the analysis object from full-time-axis data to limited data within the abnormal intervals, greatly reducing data processing volume and improving fault location efficiency. By using a time-series mapping strategy based on the same time-series marker to associate and match the multi-dimensional indicators of the operating state with the energy consumption monitoring data, each energy consumption value can be accurately mapped to the system operating state at that time. This establishes a direct causal link between system behavior and energy consumption consequences, providing a data foundation for subsequent accurate analysis of the causes of power consumption anomalies and significantly improving the accuracy of power consumption attribution. Furthermore, the use of multi-dimensional process-level energy consumption attribution improves the accuracy of anomaly localization. Attached Figure Description
[0011] Other features, objects, and advantages of the invention will become more apparent from the following detailed description of non-limiting embodiments with reference to the accompanying drawings: Figure 1 This is a flowchart illustrating the Linux system power consumption analysis method provided in Embodiment 1 of the present invention; Figure 2 This is a flowchart illustrating the Linux system power consumption analysis method provided in Embodiment 2 of the present invention; Figure 3 This is a schematic diagram of the Linux system power consumption analysis device provided in Embodiment 3 of the present invention; Figure 4 This is a schematic diagram of the terminal provided in Embodiment 4 of the present invention. Detailed Implementation
[0012] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0013] Example 1 Figure 1 This is a flowchart of a Linux system power consumption analysis method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where memory failures occur during write operations. The method can be executed by a Linux system power consumption analysis device and specifically includes the following steps: Step 110: Collect multi-dimensional indicators of Linux system operation status, including: logical operation load, storage interaction throughput, and data transmission load.
[0014] For example, the collection of multi-dimensional indicators of Linux system operation status may include: traversing the process file system directory of the Linux system and scanning all processes in the directory; for logical operation load, parsing the process status file to obtain the running time of the process in user mode and kernel mode, and calling system monitoring instructions to obtain processor core parameters; for storage interaction throughput, parsing the process input / output statistics file to obtain read_bytes data and write_bytes data.
[0015] The process traverses the Linux system's process file system directory, specifically the / proc directory. The / proc directory is a pseudo-file system containing information about all currently running processes. The data collection process scans all numeric subdirectories under this directory, where each subdirectory name corresponds to a process PID, thereby obtaining a list of all active processes in the current system.
[0016] The logical operation load represents the CPU computing resource utilization of a process. Process status files can be parsed. By reading relevant fields in the file, such as utime and stime, the cumulative runtime data of the process in user mode and kernel mode can be obtained. By calculating the difference in runtime at continuously collected time points, the real-time CPU time slice utilization can be obtained.
[0017] Meanwhile, in order to eliminate statistical errors in multi-core processor environments, the data acquisition process also calls system monitoring commands, such as reading the / proc / cpuinfo file or calling the mpstat tool, to obtain core parameters such as the number of processor cores and clock speed of the current system.
[0018] Storage interaction throughput characterizes the degree to which a process consumes disk I / O resources. The collection process parses the process input / output statistics file. By reading the read_bytes and write_bytes data, the total number of bytes read from and written to the disk by the process at the current moment can be obtained, respectively.
[0019] Data transmission load characterizes the resource consumption of a process in network communication. The collection process can obtain the total system-level network transmission and reception volume by parsing network parameter files, such as / proc / net / dev, and combine this with process network status information, such as process-level network traffic obtained with the assistance of tools like pidstat, to extract the amount of network data received and sent by a process.
[0020] Step 120: Based on the multidimensional indicators of the operating status, construct corresponding resource occupancy time series based on the same time series marker.
[0021] At the start of each acquisition cycle, the time acquisition interface is first invoked to obtain the current high-precision system timestamp. This timestamp will serve as the same time-series marker for all acquisition actions within this cycle. Whether acquiring logical operation load, storage interaction throughput, or data transmission load, the timestamp is consistently referenced to eliminate data misalignment caused by minor differences in the acquisition times of each sub-module, ensuring strict synchronization of multi-dimensional indicators across the time dimension. Furthermore, based on the timestamp, independent time-series data structures are constructed for the operational status indicators of each dimension: logical operation load, storage interaction throughput, and data transmission load.
[0022] Step 130: Synchronously collect energy consumption monitoring data, and use a time-series mapping strategy to associate and match the multi-dimensional indicators of the operating status with the energy consumption monitoring data based on the same time-series marker.
[0023] For example, the step of using a time-series mapping strategy to associate and match the multi-dimensional indicators of operating status with the energy consumption monitoring data based on the same time-series marker may include: sorting the multi-dimensional indicators of operating status and the energy consumption monitoring data according to their collection times; traversing the sorted multi-dimensional indicators of operating status, and for each multi-dimensional indicator of operating status, searching in the sorted energy consumption monitoring data for whether there is energy consumption data with completely consistent collection times; if so, performing association matching; if not, constructing a time tolerance window centered on the timestamp of the multi-dimensional indicator of operating status, and selecting the energy consumption monitoring data with the smallest timestamp difference within the time tolerance window as the nearest neighbor matching object for association matching.
[0024] While collecting multi-dimensional metrics at the acquisition end, the power meter collects the overall power consumption of the tested machine in real time based on a unified clock reference, such as the system time synchronized with the NTP network time protocol. Each power consumption data packet carries a timestamp of the acquisition time, forming an energy consumption monitoring data sequence. The synchronization mechanism aims to ensure that the start and end times of energy consumption data acquisition are consistent with the acquisition cycle of the multi-dimensional metrics of the operating status.
[0025] The time series of multi-dimensional indicators of operating status constructed in the aforementioned steps and the collected energy consumption monitoring data sequence are sorted in ascending or descending order according to their respective timestamps to ensure the monotonicity of multiple data sequences on the time axis. Based on the sorted data sequences, a time series mapping strategy is executed to associate the multi-dimensional indicators of operating status with the energy consumption monitoring data one by one.
[0026] In the sorted energy consumption monitoring data sequence, a binary search or traversal retrieval method is used to determine whether there are any energy consumption data points whose collection time is exactly the same as the energy consumption monitoring data collection time. If a record with an identical timestamp exists, a mapping relationship is directly established between the energy consumption data and the current operating status multidimensional indicators to complete the association matching.
[0027] Considering the potential millisecond-level delays or sampling period misalignments during actual data collection, if no completely identical timestamps are found in the energy consumption monitoring data, a time tolerance window of a preset duration is constructed, centered on the timestamp of the multi-dimensional indicator for that operating state. Within the time range covered by this window, all energy consumption monitoring data points are selected.
[0028] Calculate the absolute value of the difference between the timestamp of each energy consumption data point within the window and the center, and select the energy consumption monitoring data with the smallest difference as the nearest neighbor matching object. Assign or associate the energy consumption value of the nearest neighbor object with the current operating status multidimensional index, thereby completing the time-series alignment of heterogeneous data.
[0029] Step 140: Identify abnormal energy consumption fluctuation intervals based on the collected energy consumption monitoring data, and extract the time series sequence of resource occupancy in each dimension within the abnormal interval.
[0030] For example, the average energy consumption and standard deviation over the entire testing period are calculated. The energy consumption monitoring data sequence is traversed, and the energy consumption value of each sampling point is compared with a threshold. When the energy consumption value of a sampling point is greater than the threshold, that point is marked as the starting point of an anomaly; when the energy consumption value of subsequent sampling points falls below the threshold, it is marked as the ending point of an anomaly. Continuous anomaly sampling points constitute an energy consumption fluctuation anomaly interval, and the start and end timestamps of the interval are recorded. Based on the start and end timestamps, the resource occupancy time-series sequences for each dimension are extracted.
[0031] Step 150: Based on the resource occupancy time sequence within the abnormal interval, analyze the key influencing entities that cause abnormal energy consumption.
[0032] For the logical operation load subsequence, the average CPU utilization or cumulative CPU time slice of each process within the abnormal interval is calculated as the process's computational resource contribution value. For the storage interaction throughput subsequence, the process's read_bytes and write_bytes are summed within the abnormal interval to obtain the process's IO throughput contribution value. For the data transmission load subsequence, the process's network send / receive bytes are summed to obtain the process's network traffic contribution value. Based on the calculated resource contribution values, the process list is sorted in descending order along the three dimensions of logical operation, storage interaction, and data transmission. The top N processes in each dimension are selected to form the candidate key entity set for each dimension.
[0033] Furthermore, if a process's contribution in the logical operation dimension exceeds a first preset threshold, for example, accounting for more than 30% of the total CPU time within the interval, then the process is determined to be a CPU-intensive key impact entity and the anomaly type is marked as computational overload; if a process's contribution in the storage interaction dimension exceeds a second preset threshold, then the process is determined to be an I / O-intensive key impact entity and the anomaly type is marked as frequent I / O; if a process's contribution in the data transmission dimension exceeds a third preset threshold, then the process is determined to be a network-intensive key impact entity and the anomaly type is marked as network surge.
[0034] This embodiment collects multi-dimensional indicators of Linux system operation status, including logical operation load, storage interaction throughput, and data transmission load. Based on these indicators, corresponding resource usage time-series sequences are constructed using the same time-series marker. Energy consumption monitoring data is collected synchronously, and the multi-dimensional indicators are correlated with the energy consumption monitoring data using a time-series mapping strategy based on the same time-series marker. Abnormal energy consumption fluctuation intervals are identified based on the collected energy consumption monitoring data, and resource usage time-series sequences of each dimension within these abnormal intervals are extracted. Based on these resource usage time-series sequences within the abnormal intervals, the key influencing entities causing energy consumption anomalies are analyzed. This approach automatically filters out a large amount of normal steady-state operating data, directly pinpointing the critical time segments where power consumption anomalies occur, converging the analysis object from full-time-axis data to limited data within the abnormal intervals, significantly reducing data processing volume and improving fault location efficiency. By using a time-series mapping strategy based on the same time-series marker to associate and match the multi-dimensional indicators of the operating state with the energy consumption monitoring data, each energy consumption value can be accurately mapped to the system operating state at that time. This establishes a direct causal link between system behavior and energy consumption consequences, providing a data foundation for subsequent accurate analysis of the causes of power consumption anomalies and significantly improving the accuracy of power consumption attribution. Furthermore, the use of multi-dimensional process-level energy consumption attribution improves the accuracy of anomaly localization.
[0035] Example 2 Figure 2 This is a flowchart illustrating the Linux system power consumption analysis method provided in Embodiment 2 of the present invention. This embodiment is based on the above embodiment and is optimized. The method may further include the following steps: constructing a process-level power consumption feature matrix, the feature matrix including: a dimension feature representing the computing power occupancy time of the core computing load, a dimension feature representing the storage throughput of the data interaction load, and a dimension feature representing the network transmission flow of the communication load; performing time-series mapping and association between the feature matrix and the real-time collected energy consumption monitoring data to construct a model training sample set; using a preset linear regression model to fit and train the model training sample set, calculating the power consumption weight coefficient corresponding to each dimension feature, wherein the objective function of the regression prediction model includes a regularization penalty term, the regularization penalty term being used to suppress the influence of data noise in the network transmission flow dimension on the model. Accordingly, the analysis of the key influencing entities causing energy consumption anomalies based on the resource occupancy time-series sequence within the abnormal interval is specifically optimized as follows: obtaining the power consumption weight coefficients of each dimension of features obtained through fitting training; mapping the resource occupancy time-series sequence of each process within the abnormal interval to a feature vector, and performing weighted calculations in conjunction with the power consumption weight coefficients to obtain the estimated energy consumption increment value of each process within the abnormal interval; sorting each process in descending order according to the estimated energy consumption increment value, and selecting the process whose estimated energy consumption increment value exceeds a preset threshold or ranks at the top as the key influencing entity causing energy consumption anomalies.
[0036] See Figure 2 The Linux system power consumption analysis method includes: Step 210: Construct a process-level power consumption feature matrix, and perform time-series mapping and association between the feature matrix and the real-time collected energy consumption monitoring data to construct a model training sample set.
[0037] For example, historically collected multidimensional data can be used to construct resource usage time-series sequences for each dimension, thereby building a multidimensional feature matrix. Optionally, for each collection time point, the running status data of each key process at that time is extracted as feature values. Each row of the feature matrix corresponds to a time slice, and each column corresponds to a feature dimension. The constructed feature vector can contain feature values in the following three dimensions: the cumulative running time or instantaneous occupancy rate of the process in user mode and kernel mode, representing the CPU computing resource consumption intensity as a computing power occupancy time dimension feature; the read_bytes and write_bytes data of the process based on the storage interaction throughput time-series sequence, representing the disk I / O resource consumption intensity as a storage throughput dimension feature; and the total number of network sent and received bytes of the process based on the data transmission load time-series sequence, representing the network bandwidth resource consumption intensity as a network transmission flow dimension feature.
[0038] A process-level power consumption feature matrix is generated by arranging the feature vectors at consecutive time points. For example, and following the method provided in the above embodiments, a one-to-one mapping relationship is established between the feature vector of each time point in the feature matrix and the energy consumption value at the same time point in the energy consumption monitoring data sequence, based on a unified timestamp.
[0039] Based on the above mapping and correlation results, the system constructs a sample set for training the linear regression model.
[0040] Each successfully mapped pair is used as a training sample, where the feature vector serves as the model's input variable and is used as the independent variable later, and the energy consumption value serves as the model's output label and is used as the dependent variable later. Training samples generated from all historical data collection periods are aggregated, and data cleaning and standardization are performed to ultimately form a model training sample set containing the input feature matrix and the target power consumption vector.
[0041] Step 220: The model training sample set is fitted and trained using a preset linear regression model. The power consumption weight coefficient corresponding to each dimension feature is calculated. The objective function of the regression prediction model includes a regularization penalty term, which is used to suppress the impact of data noise in the network transmission traffic dimension on the model.
[0042] For example, the step of fitting and training the model training sample set using a preset linear regression model may include: standardizing the feature values of different dimensions in the feature matrix to map feature values of different dimensions to the same numerical range; constructing a power consumption prediction equation, which is expressed as: the predicted power consumption value is equal to the system's basic power consumption value plus the sum of the products of each dimension feature value and its corresponding power consumption weight coefficient; constructing a target loss function, calculating the deviation between the actual value of energy consumption monitoring data and the predicted power consumption value, and combining it with the regularization penalty term; wherein, the regularization penalty term is configured to generate a numerical penalty when the power consumption weight coefficient of the network transmission traffic dimension is too large; minimizing the value of the target loss function through iterative calculation, during the iteration process, the regularization penalty term forces the power consumption weight coefficient of the network transmission traffic dimension to tend to a smaller value or zero value, thereby reducing the interference of network transmission traffic dimension features on the model prediction results.
[0043] Optionally, a multivariate linear regression model can be pre-established as the power consumption prediction equation. The process's feature values for the three dimensions of computation time consumption, storage throughput, and network traffic are set as x1, x2, and x3, respectively, with corresponding power consumption weighting coefficients w1, w2, and w3. 3, The system's base power consumption is w0, and correspondingly, the power consumption prediction equation can be expressed as: ,in, This represents the power consumption value predicted by the model.
[0044] To solve for the aforementioned power consumption weighting coefficients, an objective loss function can be constructed. Considering that Linux system network transmission behavior is susceptible to random factors such as protocol stack jitter and link congestion, resulting in significant non-systematic noise in the network traffic data, direct fitting could easily lead to model overfitting.
[0045] Therefore, this embodiment introduces a regularization penalty term into the objective function. The objective loss function is calculated as follows: in, Let represent the i-th real energy consumption monitoring data in the sample set, N be the total number of samples, λ be the regularization coefficient, and R(W) be the regularization penalty term.
[0046] During Linux system operation, logical operation load and storage interaction throughput typically have a clear physical energy consumption correspondence: high CPU load directly corresponds to increased voltage and frequency, while disk read / write is accompanied by mechanical rotation or flash memory write power consumption, and its energy consumption changes are relatively stable and continuous. However, network traffic is different, constrained by the complex behavior of the TCP / IP protocol stack, the interrupt aggregation mechanism of the network card, and the congestion control strategy of the link layer. Network traffic often exhibits significant bursts and jitter, resulting in a large amount of random noise in its data that cannot be explained by a linear model. Direct fitting can easily lead to model overfitting. Therefore, in this embodiment, the regularization penalty term is configured as a power consumption weighting coefficient for the network traffic dimension, imposing additional numerical penalty constraints. For example, R(W) adopts the weighted L2 norm form, and its expression can be: Here, α, β, and γ are preset adjustment factors. γ can be set to a value significantly greater than α and β. Using this configuration, during model training, if data noise in the network traffic dimension causes abnormal fluctuations or excessively large values in its weight coefficients, the regularization penalty term will incur a large numerical penalty, forcing the corresponding weights to tend towards smaller values or zero during iteration, thereby suppressing the interference of data noise in this dimension on the overall model prediction accuracy. Then, the objective function is iteratively optimized using the gradient descent algorithm. In each iteration, the gradient of the objective function with respect to each weight coefficient is calculated, and the weight values are updated. When the value of the objective loss function converges to a preset threshold or the number of iterations reaches the upper limit, training ends, and the final determined set of power consumption weight coefficients is output.
[0047] Step 230: Collect multi-dimensional indicators of Linux system running status, and construct corresponding resource usage time series based on the same time series marker according to the multi-dimensional indicators of running status.
[0048] Step 240: Synchronously collect energy consumption monitoring data, and use a time-series mapping strategy to associate and match the multi-dimensional indicators of the operating status with the energy consumption monitoring data based on the same time-series marker. Identify abnormal energy consumption fluctuation intervals based on the collected energy consumption monitoring data, and extract the time-series sequence of resource occupancy in each dimension within the abnormal interval.
[0049] Step 250: Obtain the power consumption weight coefficients of each dimension of features obtained through fitting training, map the resource occupancy time sequence of each process in the abnormal interval to a feature vector, and perform weighted calculation in combination with the power consumption weight coefficients to obtain the estimated energy consumption increment value of each process in the abnormal interval.
[0050] For example, firstly, the base power consumption of the Linux system can be determined based on historical energy consumption monitoring data; then, the energy consumption monitoring data can be benchmarked using the base power consumption to obtain dynamic energy consumption increment data. Historical energy consumption monitoring data sequences stored in a database can be accessed, and the system's baseline operating power consumption can be extracted through statistical analysis. For example, firstly, historical energy consumption data is filtered to identify time periods when the system is idle. For the energy consumption values within these idle time periods, their arithmetic mean or median value is calculated and marked as the base power consumption value of the Linux system. This base power consumption value reflects the static power consumption floor of the system under no significant business load, including the base energy consumption of the motherboard chip, memory refresh, and power supply itself.
[0051] The above steps can be used to obtain the set of power consumption weight coefficients for the current Linux system optimization. For each process in the abnormal interval, the system maps its resource usage time sequence into a multi-dimensional feature vector, and performs a weighted operation on the feature vector and the power consumption weight coefficient to calculate the estimated energy consumption increment value of each process in the abnormal interval.
[0052] Step 260: Sort each process in descending order according to the estimated energy consumption increment value, and select the process whose estimated energy consumption increment value exceeds the preset threshold or ranks first as the key influencing entity causing energy consumption abnormality.
[0053] For example, based on the estimated energy consumption increment values of each process calculated above, all active processes within the current abnormal interval can be sorted to generate a process ranking list from high to low energy consumption contribution. Based on the estimated energy consumption increment values of each process calculated above, all active processes within the current abnormal interval can be sorted to generate a process ranking list from high to low energy consumption contribution. Key influencing entities are identified from the ranking list based on a preset filtering strategy. The filtering strategy can be configured as follows: traversing the sorted process list and sequentially determining whether the estimated energy consumption increment value of each process exceeds a preset energy consumption contribution threshold; or, directly selecting the top N processes in the ranking list. If a process meets either of the above conditions, it is marked as a key influencing entity causing the energy consumption anomaly and locked for output, thereby completing the final determination of the anomaly attribution.
[0054] This embodiment adds the following steps: constructing a process-level power consumption feature matrix, the feature matrix including: a dimension feature representing the computing power occupancy time of the core computing load, a dimension feature representing the storage throughput of the data interaction load, and a dimension feature representing the network transmission flow of the communication load; performing time-series mapping and association between the feature matrix and real-time collected energy consumption monitoring data to construct a model training sample set; using a preset linear regression model to fit and train the model training sample set, calculating the power consumption weight coefficient corresponding to each dimension feature, the objective function of the regression prediction model includes a regularization penalty term, the regularization penalty term is used to suppress the impact of data noise in the network transmission flow dimension on the model. Accordingly, the analysis of the key influencing entities causing energy consumption anomalies based on the resource usage time-series sequence within the abnormal interval is specifically optimized as follows: Power consumption weight coefficients for each dimension of features obtained through fitting training are acquired; the resource usage time-series sequence of each process within the abnormal interval is mapped to a feature vector, and weighted calculation is performed using the power consumption weight coefficients to obtain the estimated energy consumption increment value for each process within the abnormal interval; the processes are sorted in descending order according to the estimated energy consumption increment value, and processes with estimated energy consumption increment values exceeding a preset threshold or ranking at the top are selected as the key influencing entities causing energy consumption anomalies. By constructing a process-level power consumption feature matrix and using a linear regression model to fit and obtain the power consumption weight coefficients for each dimension of features, the actual impact of different resource dimensions on overall system energy consumption can be quantitatively characterized. Furthermore, it can effectively remove false correlations caused by network noise, making the final attribution more focused on resource behaviors such as computation / IO that actually cause energy consumption changes, thus improving the robustness and reliability of the overall method.
[0055] Example 3 Figure 3 This is a schematic diagram of the Linux system power consumption analysis device provided in Embodiment 3 of the present invention. See also... Figure 3 The Linux system power consumption analysis device includes: The acquisition module 310 is used to collect multi-dimensional indicators of the Linux system's operating status, including: logical operation load, storage interaction throughput, and data transmission load. The construction module 320 is used to construct corresponding resource occupancy time series based on the same time series marker according to the multi-dimensional indicators of the running status; The matching module 330 is used to synchronously collect energy consumption monitoring data and, based on the same time series marker, use a time series mapping strategy to associate and match the multi-dimensional indicators of the operating status with the energy consumption monitoring data. The extraction module 340 is used to identify abnormal energy consumption fluctuation intervals based on the collected energy consumption monitoring data, and extract the time series sequence of resource occupancy in each dimension within the abnormal interval; The parsing module 350 is used to analyze the key influencing entities that cause abnormal energy consumption based on the resource occupancy time sequence within the abnormal interval.
[0056] The Linux system power consumption analysis device provided in this embodiment collects multi-dimensional indicators of the Linux system's operating status, including logical operation load, storage interaction throughput, and data transmission load. Based on these multi-dimensional indicators, corresponding resource usage time-series sequences are constructed using the same time-series marker. Energy consumption monitoring data is collected synchronously, and the multi-dimensional indicators are correlated and matched with the energy consumption monitoring data using a time-series mapping strategy based on the same time-series marker. Abnormal energy consumption fluctuation intervals are identified based on the collected energy consumption monitoring data, and resource usage time-series sequences of each dimension within these abnormal intervals are extracted. Based on the resource usage time-series sequences within the abnormal intervals, the key influencing entities causing the energy consumption anomalies are analyzed. This device can automatically filter out a large amount of normal steady-state operating data, directly locking onto the key time segments where power consumption anomalies occur, converging the analysis object from full-time axis data to limited data within the abnormal intervals, greatly reducing data processing volume and improving fault location efficiency. By using a time-series mapping strategy based on the same time-series marker to associate and match the multi-dimensional indicators of the operating state with the energy consumption monitoring data, each energy consumption value can be accurately mapped to the system operating state at that time. This establishes a direct causal link between system behavior and energy consumption consequences, providing a data foundation for subsequent accurate analysis of the causes of power consumption anomalies and significantly improving the accuracy of power consumption attribution. Furthermore, the use of multi-dimensional process-level energy consumption attribution improves the accuracy of anomaly localization.
[0057] Based on the above embodiments, the matching module includes: The sorting and processing unit is used to sort the multidimensional indicators of the operating status and the energy consumption monitoring data according to the collection time, respectively. The traversal unit is used to traverse the sorted multi-dimensional indicators of the operating status. For each multi-dimensional indicator of the operating status, it searches the sorted energy consumption monitoring data to see if there is energy consumption data with completely consistent collection time. If so, it performs correlation matching. The matching unit is used to construct a time tolerance window centered on the timestamp of the multi-dimensional indicator of the operating state if the data does not exist. Within the time tolerance window, the energy consumption monitoring data with the smallest timestamp difference is selected as the nearest matching object for association matching.
[0058] Based on the above embodiments, the device further includes: A construction unit is used to construct a process-level power consumption feature matrix, the feature matrix including: a dimension feature representing the computing power occupancy time of the core computing load, a dimension feature representing the storage throughput of the data interaction load, and a dimension feature representing the network transmission flow of the communication load. The model building unit is used to perform time-series mapping and association between the feature matrix and the real-time collected energy consumption monitoring data to build a model training sample set; The training unit is used to fit the training sample set of the model using a preset linear regression model, calculate the power consumption weight coefficient corresponding to each dimension feature, and the objective function of the regression prediction model includes a regularization penalty term, which is used to suppress the impact of data noise in the network transmission traffic dimension on the model.
[0059] Based on the above embodiments, the parsing module includes: The acquisition unit is used to acquire the power consumption weight coefficients of each dimension of features obtained through fitting training; The mapping unit is used to map the resource usage time sequence of each process in the abnormal interval into a feature vector, and perform weighted calculation in combination with the power consumption weight coefficient to obtain the estimated energy consumption increment value of each process in the abnormal interval. The selection unit is used to sort the processes in descending order according to the estimated energy consumption increment value, and select the processes whose estimated energy consumption increment value exceeds a preset threshold or whose ranking is high as the key influencing entities that cause abnormal energy consumption.
[0060] Based on the above embodiments, the training unit includes: The standardization subunit is used to standardize the feature values of different dimensions in the feature matrix so as to map feature values of different dimensions to the same numerical range. The equation construction sub-unit is used to construct the power consumption prediction equation, which is expressed as: the predicted power consumption value is equal to the system's basic power consumption value plus the sum of the products of the feature values of each dimension and their corresponding power consumption weight coefficients; The loss function construction subunit is used to construct the target loss function, calculate the deviation between the actual value of energy consumption monitoring data and the predicted power consumption value, and combine it with the regularization penalty term; wherein, the regularization penalty term is configured to generate a numerical penalty when the power consumption weight coefficient in the network transmission traffic dimension is too large; The iterative calculation subunit is used to minimize the value of the target loss function through iterative calculation. During the iteration process, the regularization penalty term forces the power consumption weight coefficient of the network transmission traffic dimension to tend to a smaller value or zero value, thereby reducing the interference of network transmission traffic dimension features on the model prediction results.
[0061] Based on the above embodiments, the parsing module includes: A determination unit is used to determine the basic power consumption of the Linux system based on historical energy consumption monitoring data; A calibration unit is used to perform benchmark calibration on the energy consumption monitoring data using the base power consumption to obtain dynamic energy consumption increment data. Accordingly, the matching module is used to: perform time-series mapping association between the feature matrix and the dynamic energy consumption increment data.
[0062] Based on the above embodiments, the acquisition module includes: The traversal unit is used to traverse the process file system directory of the Linux system and scan all processes in the directory; The parsing unit is used to parse the process status file to obtain the process's runtime in user mode and kernel mode for logical operation loads, and to call system monitoring instructions to obtain processor core parameters. The acquisition unit is used to obtain read_bytes and write_bytes data by parsing the process input / output statistics file for storage interaction throughput.
[0063] The Linux system power consumption analysis device provided in this embodiment of the invention can execute the Linux system power consumption analysis method provided in any embodiment of the invention, and has the corresponding functional modules and beneficial effects of executing the method.
[0064] Example 4 Figure 4 This is a schematic diagram of the structure of a terminal provided in Embodiment 4 of the present invention. Figure 4 A block diagram is shown of an exemplary terminal 12 suitable for implementing embodiments of the present invention. Figure 4 The terminal 12 shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of the present invention.
[0065] like Figure 4As shown, terminal 12 is presented in the form of a general-purpose computing terminal. The components of terminal 12 may include, but are not limited to: one or more processors or processing units 16, system memory 28, and bus 18 connecting different system components (including system memory 28 and processing unit 16).
[0066] Bus 18 represents one or more of several bus architectures, including a memory bus or memory controller, a peripheral bus, a graphics acceleration port, a processor, or a local bus using any of the various bus architectures. For example, these architectures include, but are not limited to, the Industry Standard Architecture (ISA) bus, the Micro Channel Architecture (MAC) bus, the Enhanced ISA bus, the Video Electronics Standards Association (VESA) local bus, and the Peripheral Component Interconnect (PCI) bus.
[0067] Terminal 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by terminal 12, including volatile and non-volatile media, removable and non-removable media.
[0068] System memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache 32. Terminal 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, storage system 34 may be used to read and write non-removable, non-volatile magnetic media (… Figure 4 Not shown; usually referred to as a "hard drive"). Although Figure 4 Not shown, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk") and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 via one or more data media interfaces. Memory 28 may include at least one program product having a set (e.g., at least one) of program modules configured to perform the functions of the embodiments of the present invention.
[0069] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in memory 28. Such program modules 42 include, but are not limited to, an operating system, one or more application programs, other program modules, and program data. Each or some combination of these examples may include an implementation of a network environment. Program modules 42 typically perform the functions and / or methods described in the embodiments of the present invention.
[0070] Terminal 12 can also communicate with one or more external terminals 14 (e.g., keyboard, pointing terminal, display 24, etc.), one or more terminals that enable a user to interact with terminal 12, and / or any terminal (e.g., network card, modem, etc.) that enables terminal 12 to communicate with one or more other computing terminals. This communication can be performed via input / output (I / O) interface 22. Furthermore, terminal 12 can also communicate with one or more networks (e.g., local area network (LAN), wide area network (WAN), and / or public networks, such as the Internet) via network adapter 20. As shown, network adapter 20 communicates with other modules of terminal 12 via bus 18. It should be understood that, although not shown in the figures, other hardware and / or software modules can be used in conjunction with terminal 12, including but not limited to: microcode, terminal drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0071] The processing unit 16 executes various functional applications and data processing by running programs stored in the system memory 28, such as implementing the Linux system power consumption analysis method provided in the embodiments of the present invention.
[0072] Example 5 Embodiment 5 of the present invention also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the Linux system power consumption analysis method as described in any of the above embodiments.
[0073] The computer storage medium of this invention can be any combination of one or more computer-readable media. A computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. For example, a computer-readable storage medium can be, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this document, a computer-readable storage medium can be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
[0074] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, capable of sending, propagating, or transmitting programs for use by or in connection with an instruction execution system, apparatus, or device.
[0075] Program code contained on a computer-readable medium may be transmitted using any suitable medium, including, but not limited to, wireless, wire, optical fiber, RF, etc., or any suitable combination thereof.
[0076] Computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as "C" or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or terminal. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0077] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A method for power consumption analysis of a Linux system, characterized in that, include: Collect multi-dimensional metrics of Linux system operation status, including: logical operation load, storage interaction throughput, and data transmission load. Based on the multidimensional indicators of the operating status, corresponding resource occupancy time series are constructed respectively based on the same time series marker; Energy consumption monitoring data is collected synchronously, and the multi-dimensional indicators of the operating status are associated and matched with the energy consumption monitoring data based on the same time series marker using a time series mapping strategy; Based on the collected energy consumption monitoring data, identify abnormal energy consumption fluctuation intervals and extract the time series sequence of resource occupancy in each dimension within the abnormal intervals; Based on the time-series sequence of resource usage within the abnormal interval, the key influencing entities that cause abnormal energy consumption are analyzed.
2. The method according to claim 1, characterized in that, The step of associating and matching the multi-dimensional indicators of the operating status with the energy consumption monitoring data based on the same time-series label using a time-series mapping strategy includes: The multidimensional indicators of the operating status and the energy consumption monitoring data are sorted and processed according to the collection time, respectively. Iterate through the sorted multi-dimensional indicators of the operating status. For each multi-dimensional indicator of the operating status, search the sorted energy consumption monitoring data to see if there is energy consumption data with completely consistent collection time. If so, perform correlation matching. If it does not exist, a time tolerance window is constructed centered on the timestamp of the multidimensional indicator of the operating status. Within the time tolerance window, the energy consumption monitoring data with the smallest timestamp difference is selected as the nearest matching object for association matching.
3. The method according to claim 1, characterized in that, The method further includes: Construct a process-level power consumption feature matrix, which includes: a feature of computing power occupancy time representing the core computing load, a feature of storage throughput representing the data interaction load, and a feature of network transmission flow representing the communication load. The feature matrix is correlated with the real-time collected energy consumption monitoring data through a time-series mapping to construct a model training sample set; The model training sample set is fitted and trained using a preset linear regression model. The power consumption weight coefficient corresponding to each dimension feature is calculated. The objective function of the regression prediction model includes a regularization penalty term, which is used to suppress the impact of data noise in the network transmission traffic dimension on the model.
4. The method according to claim 3, characterized in that, The analysis of key entities causing abnormal energy consumption based on the resource usage time-series sequence within the abnormal interval includes: Obtain the power consumption weight coefficients of each dimension of features obtained through fitting training; The resource usage time sequence of each process within the abnormal interval is mapped to a feature vector, and weighted by the power consumption weight coefficient to obtain the estimated energy consumption increment of each process within the abnormal interval. The processes are sorted in descending order based on the estimated energy consumption increment value, and the processes whose estimated energy consumption increment value exceeds the preset threshold or whose ranking is at the top are selected as the key entities causing abnormal energy consumption.
5. The method according to claim 3, characterized in that, The step of fitting and training the model training sample set using a preset linear regression model includes: The feature values of different dimensions in the feature matrix are standardized to map feature values of different dimensions to the same numerical range; A power consumption prediction equation is constructed, which is expressed as: the predicted power consumption value is equal to the system's basic power consumption value plus the sum of the products of the feature values of each dimension and their corresponding power consumption weight coefficients; A target loss function is constructed to calculate the deviation between the actual value of energy consumption monitoring data and the predicted power consumption value, and the regularization penalty term is combined with it; wherein, the regularization penalty term is configured to generate a numerical penalty when the power consumption weight coefficient in the network transmission traffic dimension is too large; The target loss function is minimized through iterative calculation. During the iteration process, the regularization penalty term forces the power consumption weight coefficient of the network transmission traffic dimension to tend to a smaller value or zero value, thereby reducing the interference of network transmission traffic dimension features on the model prediction results.
6. The method according to claim 3, characterized in that, The analysis of key entities causing abnormal energy consumption based on the resource usage time-series sequence within the abnormal interval includes: The base power consumption of the Linux system was determined based on historical energy consumption monitoring data. The energy consumption monitoring data is calibrated using the baseline power consumption to obtain dynamic energy consumption increment data. The step of performing a time-series mapping association between the feature matrix and the real-time collected energy consumption monitoring data includes: The feature matrix is associated with the dynamic energy consumption increment data through a time-series mapping.
7. The method according to claim 1, characterized in that, The collected multi-dimensional indicators of Linux system operating status include: Traverse the process file system directory of the Linux system and scan all processes in the directory; For logical operation loads, the process state file is parsed to obtain the process's runtime in user mode and kernel mode, and system monitoring instructions are called to obtain processor core parameters; For storage interaction throughput, the process input / output statistics file is parsed to obtain read_bytes and write_bytes data.
8. A power consumption analysis device for a Linux system, characterized in that, include: The data acquisition module is used to collect multi-dimensional indicators of the Linux system's operating status, including: logical operation load, storage interaction throughput, and data transmission load. The construction module is used to construct corresponding resource occupancy time series based on the same time series marker according to the multi-dimensional indicators of the running status; The matching module is used to synchronously collect energy consumption monitoring data and, based on the same time series marker, use a time series mapping strategy to associate and match the multi-dimensional indicators of the operating status with the energy consumption monitoring data. The extraction module is used to identify abnormal energy consumption fluctuation intervals based on the collected energy consumption monitoring data, and extract the time series sequence of resource occupancy in each dimension within the abnormal interval; The parsing module is used to analyze the key entities that cause abnormal energy consumption based on the resource usage time sequence within the abnormal interval.
9. A terminal, characterized in that, include: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the Linux system power consumption analysis method as described in any one of claims 1-7.
10. A storage medium containing computer-executable instructions, characterized in that, The computer-executable instructions, when executed by a computer processor, are used to perform the Linux system power consumption analysis method as described in any one of claims 1-7.