Online duration processing method, device, and storage medium

By grouping and processing application log data, the online duration of IoT devices can be accurately calculated, solving the problem of the inability to reasonably determine the online duration of IoT devices in existing technologies, and providing an accurate basis for evaluating APP performance.

CN115914356BActive Publication Date: 2026-02-27HAIER YOUJIA INTELLIGENT TECH (BEIJING) CO LTD +2
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211212418.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-29
Publication Date
2026-02-27
Estimated Expiration
2042-09-29

AI Technical Summary

Technical Problem

Existing technologies cannot reasonably determine the online duration of IoT devices, making it impossible to accurately evaluate application performance.

Method used

By acquiring application log data, arranging logs in chronological order, defining log groups, calculating the online duration of IoT devices, eliminating invalid time periods, and accurately calculating the actual online duration of IoT devices.

Benefits of technology

It enables precise calculation of the online time of IoT devices, provides an accurate basis for evaluating APP performance, eliminates invalid time during APP background operation, and improves the objectivity and authenticity of the evaluation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115914356B_ABST
    Figure CN115914356B_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of data processing, and particularly relates to an online duration processing method, equipment and storage medium, and relates to the field of communication technology. The method comprises the following steps: acquiring a plurality of log data arranged in time sequence by an application program, each log being one of the following logs: a log of the application program entering the foreground, a log of the application program entering the background, a last log of the application program, a log of an internet-of-things device controlled by the application program being online, or a log of the internet-of-things device being offline; acquiring a log group according to the log data, the logs in the log group being arranged in time sequence, the first log of each log group being the log of entering the foreground, the last log being the log of entering the background or the last log of the application program closest in time to the log of entering the foreground, and the intermediate logs being the online and offline logs of the internet-of-things device; and acquiring the online duration of the internet-of-things device according to each log group. The method of the application can accurately calculate the actual online duration of the internet-of-things device in the application program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of data processing technology, and specifically relates to an online duration processing method, device and storage medium. Background Technology

[0002] For IoT applications (APPs), the online duration of IoT devices controlled by the APP is one of the important indicators for measuring APP performance.

[0003] The existing method for calculating the online time of IoT devices mainly uses the time when the APP enters the foreground and background in the log data, and calculates the difference between the time when it enters the foreground and background, which is the online time of the IoT device.

[0004] However, existing methods cannot reasonably determine the online duration of IoT devices. Summary of the Invention

[0005] To address the aforementioned problems in the prior art, namely, to resolve the issue that existing methods cannot reasonably determine the online duration of IoT devices, this invention provides an online duration processing method, comprising:

[0006] Obtain application log data, which includes multiple logs arranged in chronological order. Each log is one of the following: the application enters the foreground, the application enters the background, the last log of the application, the log of the IoT device controlled by the application being online, or the log of the IoT device being offline.

[0007] Based on the log data, log groups are obtained. The logs in the log groups are arranged in chronological order. The first log in each log group is the log of entering the foreground, the last log is the log of entering the background or the last log of the application that is closest to the time of entering the foreground, and the logs in the middle are the online and offline logs of IoT devices.

[0008] Get the online duration of IoT devices based on each log group.

[0009] In one possible design, obtaining the online duration of IoT devices based on each log group includes:

[0010] For each log group, obtain the online duration of the IoT device for that log group;

[0011] The total online time of the IoT device is obtained by considering the online time of at least one log group corresponding to the IoT device.

[0012] In one possible design, obtaining the online duration of the IoT device for each log group includes:

[0013] For the aforementioned IoT device, obtain the duration that satisfies the following conditions:

[0014] The first duration is formed by the difference between the timestamp of the offline log of the IoT device and the timestamp of the log brought to the foreground;

[0015] The second duration is formed by the difference between the timestamp of the offline log of the IoT device and the timestamp of the online log of the IoT device;

[0016] The third duration is formed by the difference between the timestamp of the background log and the timestamp of the online log of the IoT device;

[0017] The fourth duration is formed by the difference between the timestamp of the last log entry of the application and the timestamp of the online log entry of the IoT device;

[0018] The online duration of the IoT device for the log group is determined based on the first duration, the second duration, the third duration, and the fourth duration.

[0019] In one possible design, obtaining the online duration of the IoT device based on the online duration of at least one log group corresponding to the IoT device includes:

[0020] The online duration of at least one log group corresponding to the IoT device is summed to obtain the total online duration of the IoT device.

[0021] In one possible design, after obtaining the total online time of the IoT device based on the online time of at least one log group corresponding to the IoT device, the method further includes:

[0022] Based on the timestamps of the logs entering the foreground and the logs entering the background in each log group, the runtime of the application for the log group is obtained;

[0023] The total runtime is obtained by summing the runtime of the application for each log group.

[0024] Based on the total online time and the total runtime, the online percentage of IoT devices is obtained.

[0025] In one possible design, if the log data indicates that the application controls at least two IoT devices, then after obtaining the online percentage of IoT devices based on the total online time and the total runtime, the method further includes:

[0026] Calculate the average online time based on the total online time of each IoT device;

[0027] Based on the average online time and the total runtime, obtain the average online percentage of at least two IoT devices.

[0028] In one possible design, obtaining the application's log data includes:

[0029] The application's log data is obtained according to a preset interface, which includes application start and end flags.

[0030] Secondly, this application provides an online time processing device, comprising:

[0031] The acquisition module is used to acquire application log data, which includes multiple logs arranged in chronological order. Each log is one of the following: the log of the application entering the foreground, the log of the application entering the background, the last log of the application, the log of the IoT device controlled by the application being online, or the log of the IoT device being offline.

[0032] The processing module is used to obtain log groups based on the log data. The logs in the log groups are arranged in chronological order. The first log in each log group is the log that enters the foreground, the last log is the log that enters the background or the last log of the application that is closest to the time of the log that enters the foreground, and the logs in the middle are the online and offline logs of IoT devices.

[0033] The output module is used to obtain the online duration of IoT devices based on each log group.

[0034] Thirdly, this application provides an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0035] The memory stores computer-executed instructions;

[0036] The processor executes computer execution instructions stored in the memory to implement the online duration processing method.

[0037] Fourthly, this application provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement an online duration processing method.

[0038] Those skilled in the art will understand that the online duration processing method, device, and storage medium provided by the present invention obtain application log data, which includes multiple logs arranged in chronological order. Each log is one of the following: a log of the application entering the foreground, a log of the application entering the background, the last log of the application, a log of the IoT device controlled by the application being online, or a log of the IoT device being offline. Based on the log data, log groups are obtained, where the logs in the log groups are arranged in chronological order. The first log in each log group is a log of the application entering the foreground, the last log is a log of the application entering the background that is closest to the log of the application entering the foreground, or the last log of the application, and the logs in the middle are the online and offline logs of the IoT devices. Based on each log group, a means of obtaining the online duration of the IoT devices is used to accurately calculate the actual online duration of the IoT devices in the application. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a schematic diagram illustrating an application scenario for online duration processing provided in the embodiments of this application;

[0041] Figure 2 A flowchart illustrating the online duration processing method provided in Embodiment 1 of this application;

[0042] Figure 3 A flowchart illustrating the online duration processing method provided in Embodiment 2 of this application;

[0043] Figure 4 A flowchart illustrating the online duration processing method provided in Embodiment 3 of this application;

[0044] Figure 5 This is a schematic diagram of the structure of the online duration processing device provided in the embodiments of this application;

[0045] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0046] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application as detailed in the appended claims, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without inventive effort are within the scope of protection of this invention.

[0047] Figure 1 This is a schematic diagram illustrating an application scenario of the online duration processing method provided in this application embodiment. For example... Figure 1 As shown, IoT devices 101, such as televisions, washing machines, and air conditioners, are all connected to a cloud server 102. Mobile terminal devices 103 are pre-installed with an application (APP) for managing multiple IoT devices. Multiple IoT devices 101 are pre-configured and managed in the APP, so that after the APP is launched, it can obtain logs and other data information of each IoT device 101 through the cloud server 102, which facilitates integrated management. An important indicator for evaluating the performance of the APP is the online time of the IoT devices 101. The existing method for calculating the online time of IoT devices mainly calculates the difference between the time the APP enters the foreground and the time it enters the background in the log data. Obviously, this one-size-fits-all approach cannot reasonably determine the actual online time of IoT devices. The online time processing method provided in this application, according to the time sequence of the obtained application log data, defines the log data of the device entering the foreground and the log data of the device entering the background or the last log data that entered the foreground as a log group. Within the log group, the online time of the IoT device during the operation of the APP in the foreground is counted, thereby eliminating the online time of the IoT device obtained during the operation of the APP in the background. This allows for accurate statistics on the actual usage time of the IoT device on the APP, aiming to solve the above-mentioned technical problems of the prior art.

[0048] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.

[0049] Figure 2 This is a schematic flowchart of the online time processing method provided in Embodiment 1 of this application. Figure 2 As shown, the online duration processing method includes:

[0050] 201. Obtain application log data, the log data including multiple logs arranged in chronological order, each log being one of the following: the application entering the foreground log, the application entering the background log, the last log of the application, the log of the IoT device controlled by the application being online, or the log of the IoT device being offline.

[0051] Specifically, the application's log data includes a timestamp to mark when the data was generated, a device identifier (device ID) to mark the IoT device to which the data belongs, and interface data to mark the dynamics of the APP. Based on the timestamp, multiple log data containing device identifiers and interface data can be sorted in chronological order.

[0052] The interface data includes data related to the APP's startup, entry into the foreground, entry into the background, and the last log entry (the last log entry indicates that the APP has exited or gone offline). It also includes data related to the online and offline status of devices connected to the APP and IoT devices. Here, online and offline status of devices refer to the online and offline status of IoT devices on the APP, rather than the online and offline status of IoT devices themselves with the Internet.

[0053] In one possible real-time approach, the range of log data acquisition can be determined based on the interface data. For example, based on preset application start and end flags, the batch log data can be divided into multiple log intervals with different values. Each log interval with different values ​​records a complete running process of an application.

[0054] 202. Based on the log data, obtain log groups. The logs in the log groups are arranged in chronological order. The first log in each log group is the log of entering the foreground, the last log is the log of entering the background or the last log of the application that is closest to the time of the log of entering the foreground, and the logs in the middle are the online and offline logs of IoT devices.

[0055] Specifically, the obtained log range of values ​​is further grouped into a log group. Each log group contains a first log and a last log in chronological order, that is, it contains a log data that enters the foreground and a log data that enters the background, or it contains a log data that enters the foreground and a last log data with an application end marker.

[0056] The logs between the first and last logs, arranged chronologically, contain data on device online and offline status used to mark the connection between the app and IoT devices.

[0057] 203. Obtain the online duration of IoT devices based on each log group.

[0058] Specifically, in chronological order, the online duration of the same IoT device within each log group is obtained, and then the online duration of the same IoT device within all log groups is summed to obtain the actual online duration of the same IoT device after the APP is launched.

[0059] The online duration of the same IoT device within each log group is calculated based on the time difference between data from different interfaces within the log group.

[0060] Specifically, firstly, within the same log group, based on the interface data, calculate the time difference between the most recent device going offline and entering the foreground, or the time difference between the most recent device going offline and entering the online, or the time difference between the most recent device entering the background and entering the online, or, if no device is online or offline, directly calculate the time difference between the most recent device entering the background and entering the foreground. Then, sum at least one of the calculated time differences to obtain the online duration of the same IoT device within the group.

[0061] The method provided in this embodiment obtains application log data, which includes multiple logs arranged in chronological order. Each log is one of the following: a log of the application entering the foreground, a log of the application entering the background, the last log of the application, a log of the IoT device controlled by the application being online, or a log of the IoT device being offline. Based on the log data, a log group is obtained, where the logs in the log group are arranged in chronological order. The first log in each log group is the log of the application entering the foreground, the last log is the log of the application entering the background that is closest to the log of the application entering the foreground, or the last log of the application, and the logs in the middle are the online and offline logs of the IoT device. Based on each log group, a means of obtaining the online duration of the IoT device is used to accurately calculate the actual online duration of the IoT device in the application.

[0062] The online time processing method of this application will be described in detail below with reference to a specific embodiment.

[0063] Figure 3 This is a schematic flowchart of the online duration processing method provided in Embodiment 2 of this application. Figure 3 As shown, the method includes:

[0064] S301. Obtain application log data according to a preset interface. The preset interface includes application start and end flags. The log data includes multiple logs arranged in chronological order. Each log is one of the following: the log of the application entering the foreground, the log of the application entering the background, the last log of the application, the log of the IoT device controlled by the application being online, or the log of the IoT device being offline.

[0065] Specifically, taking the APP managing two IoT devices as an example, the device IDs of the two IoT devices are did1 and did2 respectively. As shown in Table 1, the APP obtains a set of application log data from the cloud server. The scope of the application log data is determined according to the preset interface. The preset interface includes the application startup and termination flags, that is, the startup program and the last record in the interface data.

[0066] Table 1

[0067]

[0068]

[0069] S302. Based on the log data, obtain a log group. The logs in the log group are arranged in chronological order. The first log in each log group is the log of entering the foreground, the last log is the log of entering the background or the last log of the application that is closest to the time of the log of entering the foreground, and the logs in the middle are the online and offline logs of IoT devices.

[0070] Specifically, based on the log data shown in Table 1, the data is divided into multiple log groups. Table 2 shows the log group corresponding to did1, and Table 3 shows the log group corresponding to did2. Since the application performs background initialization and login connection operations after startup, the actual usage time is calculated from the point when the interface data enters the foreground.

[0071] Table 2

[0072] Log group number Serial Number Timestamp Device ID Interface data 1 4 1661058946749 Enter the front desk 1 8 1661058947200 didl Device offline 1 12 1661058947596 didl Equipment online 1 15 1661058948005 Access the backend 2 20 1661058948350 Enter the front desk 2 22 1661058950683 didl Device offline 2 26 1661058953600 didl Equipment online 2 31 1661058955571 Last one

[0073] Table 3

[0074] Log group number Serial Number Timestamp Device ID Interface data 3 4 1661058946749 Enter the front desk 3 9 1661058947202 did2 Device offline 3 13 1661058947688 did2 Equipment online 3 15 1661058948005 Access the backend 4 20 1661058948350 Enter the front desk 4 23 1661058950899 did2 Device offline 4 27 1661058953861 did2 Equipment online 4 31 1661058955571 Last one

[0075] S303. For the IoT device, obtain the duration that satisfies the conditions as described in S304-S307;

[0076] The conditions in steps S304-S307 can be any one of them, or any number of them. If there are repeated conditions, they need to be calculated cumulatively.

[0077] S304, the first duration formed by the difference between the timestamp of the offline log of the IoT device and the timestamp of the front-end log;

[0078] As shown in Table 2, the first duration of log group 1 = device offline timestamp - foreground timestamp = 1661058947200 - 1661058946749 = 451; the first duration of log group 2 = device offline timestamp - foreground timestamp = 1661058950683 - 1661058948350 = 2333;

[0079] S305, the second duration formed by the difference between the timestamp of the offline log of the IoT device and the timestamp of the online log of the IoT device;

[0080] Specifically, if there are multiple pairs of devices online and offline between the front end and the back end, then the second duration needs to be calculated as: device offline timestamp - device online timestamp.

[0081] S306, The third duration formed by the difference between the timestamp of the background log and the timestamp of the online log of the IoT device;

[0082] As shown in Table 2, the third duration = background entry timestamp - device online timestamp = 1661058948005 - 1661058947596 = 409;

[0083] S307, the fourth duration formed by the difference between the timestamp of the last log entry of the application and the timestamp of the online log entry of the IoT device;

[0084] As shown in Table 2, the fourth duration = the last timestamp - the device online timestamp = 1661058955571 - 1661058953600 = 1971;

[0085] S308. Determine the online duration of the IoT device for the log group based on the first duration, the second duration, the third duration, and the fourth duration;

[0086] Specifically, the online duration of log group 1 = 451 + 409 = 860; the online duration of log group 2 = 2333 + 1971 = 4304;

[0087] S309. Sum the online duration of at least one log group corresponding to the IoT device to obtain the total online duration of the IoT device.

[0088] Specifically, the total online time of IoT devices = online time of log group 1 + online time of log group 2 = 860 + 4304 = 5164.

[0089] The method provided in this embodiment obtains application log data, which includes multiple logs arranged in chronological order. Each log is one of the following: a log of the application entering the foreground, a log of the application entering the background, the last log of the application, a log of the IoT device controlled by the application being online, or a log of the IoT device being offline. Based on the log data, a log group is obtained, where the logs in the log group are arranged in chronological order. The first log in each log group is the log of the application entering the foreground, the last log is the log of the application entering the background most recently (or the last log of the application), and the logs in the middle are the online and offline logs of the IoT device. For the IoT device, the duration that satisfies the following condition is obtained: the difference between the timestamp of the offline log of the IoT device and the timestamp of the log of the application entering the foreground. The following timeframes are used to determine the online duration of an IoT device for a given log group: a first duration formed by the difference between the timestamp of the IoT device's offline log and the timestamp of the IoT device's online log; a second duration formed by the difference between the timestamp of the background log and the timestamp of the IoT device's online log; and a fourth duration formed by the difference between the timestamp of the last log entry of the application and the timestamp of the IoT device's online log. This method involves summing the online durations of at least one log group corresponding to the IoT device to obtain the total online duration of the IoT device. Through simple grouping, invalid time periods are eliminated, accurately reflecting the online duration of the IoT device on the APP and providing an accurate basis for APP performance evaluation.

[0090] Figure 4 This is a schematic flowchart of the online duration processing method provided in Embodiment 3 of this application. Figure 4 As shown, based on the above embodiments, the method further includes:

[0091] S401. Based on each log group, obtain the online duration of the IoT device for the log group;

[0092] Specifically, after acquiring the log groups, it is necessary to calculate the online time of IoT devices within each log group. The online time of IoT devices within each log group may account for the entire time of the entire log group, or it may only account for a small portion of the entire log group's time. Therefore, it is necessary to calculate the actual online time of IoT devices within each log group.

[0093] S402. Based on the online duration of at least one log group corresponding to the IoT device, obtain the total online duration of the IoT device;

[0094] Specifically, in order to evaluate the online time percentage, we first need to obtain the total online time of the same IoT device in all log groups, so as to reflect the actual connection status of the IoT device during a complete run of the APP after its launch.

[0095] S403. Based on the timestamps of the foreground logs and the timestamps of the background logs in each log group, obtain the runtime of the application for the log group;

[0096] Specifically, after obtaining the total online time of IoT devices, in order to calculate the online percentage, it is necessary to obtain the total online time of the APP. Since the log data is divided into multiple log groups, it is necessary to first obtain the runtime of each log group. The runtime only includes the runtime of the APP when it is online, and does not include the runtime when the APP enters the background or exits offline.

[0097] S404. Sum the runtime of the application for each log group to obtain the total runtime;

[0098] Specifically, by summing the runtime of each log group, you can obtain the total runtime of the app after it starts.

[0099] S405. Obtain the online percentage of IoT devices based on the total online time and the total running time;

[0100] Specifically, the online percentage of the same IoT device is obtained by dividing the total online time of the same IoT device by the total runtime of the APP.

[0101] S406. If the log data indicates that the application controls at least two IoT devices, obtain the average online time based on the total online time of each IoT device;

[0102] Specifically, when there are multiple IoT devices in the log data, the total online time of each IoT device should be counted first. Then, the total online time of each IoT device should be added together and divided by the number of IoT devices to obtain the average online time of each IoT device.

[0103] S407. Based on the average online time and the total running time, obtain the average online percentage of at least two IoT devices.

[0104] Specifically, by dividing the average online time obtained by S403-S404 by the total runtime obtained, the average online percentage of each IoT device can be obtained. By averaging the online time of each IoT device, it is more conducive to reflecting the actual performance of the APP and avoiding the influence of IoT device factors on APP performance. Theoretically, the more IoT devices there are, the more reliable the APP performance it reflects.

[0105] The method provided in this embodiment obtains the online duration of IoT devices for each log group; obtains the total online duration of IoT devices for at least one log group corresponding to the IoT device; obtains the runtime of the application for each log group based on the timestamps of the logs entering the foreground and the logs entering the background in each log group; sums the runtime of the application for each log group to obtain the total runtime; obtains the online percentage of IoT devices based on the total online duration and the total runtime; if the log data indicates that the application controls at least two IoT devices, obtains the average online duration based on the total online duration of each IoT device; and obtains the average online percentage of at least two IoT devices based on the average online duration and the total runtime. This method enables the acquisition of the online percentage of IoT devices connected to the APP or the average online percentage of multiple IoT devices connected to the APP after the APP is launched. This facilitates developers in evaluating the performance of the APP based on the online percentage and the average online percentage. Because the actual online duration of IoT devices is accurately counted, the evaluation is more objective and realistic, and better reflects the actual connection performance of the APP.

[0106] In this embodiment of the invention, electronic devices or main control devices can be divided into functional modules according to the above method examples. For example, each function can be divided into its own functional modules, or two or more functions can be integrated into one processing unit. The integrated unit can be implemented in hardware or as a software functional module. It should be noted that the module division in this embodiment of the invention is illustrative and only represents one logical functional division; other division methods may be used in actual implementation.

[0107] Figure 5 A schematic diagram of the online duration processing device provided in this application. Figure 5 As shown, the device 50 includes:

[0108] The acquisition module 501 is used to acquire application log data, which includes multiple logs arranged in chronological order. Each log is one of the following: the log of the application entering the foreground, the log of the application entering the background, the last log of the application, the log of the IoT device controlled by the application being online, or the log of the IoT device being offline.

[0109] Specifically, the acquisition module 501 is used for: acquiring application log data, including:

[0110] The application's log data is obtained according to a preset interface, which includes application start and end flags.

[0111] Processing module 502 is used to obtain log groups based on the log data. The logs in the log groups are arranged in chronological order. The first log in each log group is the log that enters the foreground, the last log is the log that enters the background or the last log of the application that is closest to the time of the log that enters the foreground, and the logs in the middle are the online and offline logs of IoT devices.

[0112] Output module 503 is used to obtain the online duration of IoT devices based on each log group.

[0113] Specifically, the output module 503 is used for: obtaining the online duration of IoT devices based on each log group, including:

[0114] For each log group, obtain the online duration of the IoT device for that log group;

[0115] The total online time of the IoT device is obtained by considering the online time of at least one log group corresponding to the IoT device.

[0116] In one possible design, obtaining the online duration of the IoT device for each log group includes:

[0117] For the aforementioned IoT device, obtain the duration that satisfies the following conditions:

[0118] The first duration is formed by the difference between the timestamp of the offline log of the IoT device and the timestamp of the log brought to the foreground;

[0119] The second duration is formed by the difference between the timestamp of the offline log of the IoT device and the timestamp of the online log of the IoT device;

[0120] The third duration is formed by the difference between the timestamp of the background log and the timestamp of the online log of the IoT device;

[0121] The fourth duration is formed by the difference between the timestamp of the last log entry of the application and the timestamp of the online log entry of the IoT device;

[0122] The online duration of the IoT device for the log group is determined based on the first duration, the second duration, the third duration, and the fourth duration.

[0123] In one possible design, obtaining the online duration of the IoT device based on the online duration of at least one log group corresponding to the IoT device includes:

[0124] The online duration of at least one log group corresponding to the IoT device is summed to obtain the total online duration of the IoT device.

[0125] In one possible design, after obtaining the total online time of the IoT device based on the online time of at least one log group corresponding to the IoT device, the method further includes:

[0126] Based on the timestamps of the logs entering the foreground and the logs entering the background in each log group, the runtime of the application for the log group is obtained;

[0127] The total runtime is obtained by summing the runtime of the application for each log group.

[0128] Based on the total online time and the total runtime, the online percentage of IoT devices is obtained.

[0129] In one possible design, if the log data indicates that the application controls at least two IoT devices, then after obtaining the online percentage of IoT devices based on the total online time and the total runtime, the method further includes:

[0130] Calculate the average online time based on the total online time of each IoT device;

[0131] Based on the average online time and the total runtime, obtain the average online percentage of at least two IoT devices.

[0132] The online duration processing device provided in this embodiment can execute the online duration processing method of the above embodiment. Its implementation principle and technical effect are similar, and will not be described again here.

[0133] In the specific implementation of the aforementioned online duration processing device, each module can be implemented as a processor. The processor can execute computer execution instructions stored in the memory, thereby enabling the processor to perform the aforementioned online duration processing method.

[0134] Figure 6 A schematic diagram of the structure of the electronic device provided in this application. Figure 6 As shown, the electronic device 60 includes at least one processor 601 and a memory 602. The electronic device 60 also includes a communication component 603. The processor 601, memory 602, and communication component 603 are connected via a bus 604.

[0135] In the specific implementation process, at least one processor 601 executes the computer execution instructions stored in the memory 602, causing at least one processor 601 to execute the online duration processing method executed on the electronic device side as described above.

[0136] The specific implementation process of processor 601 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0137] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0138] The memory may include high-speed RAM, and may also include non-volatile storage (NVM), such as at least one disk storage.

[0139] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0140] The above description of the functions implemented by electronic devices and main control devices has introduced the solutions provided by the embodiments of the present invention. It is understood that, in order to implement the above functions, the electronic device or main control device includes hardware structures and / or software modules corresponding to the execution of each function. By combining the units and algorithm steps of the various examples described in the embodiments of the present invention, the embodiments of the present invention can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed by hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the technical solutions of the embodiments of the present invention.

[0141] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described online duration processing method.

[0142] The aforementioned computer-readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0143] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in an electronic device or a host device.

[0144] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0145] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. An online duration processing method, characterized in that, The method comprises the following steps: acquiring log data of an application, the log data comprising a plurality of logs arranged in chronological order, each log being one of the following logs: a log of the application entering the foreground, a log of the application entering the background, a last log of the application, a log of an Internet of Things device controlled by the application being online, or a log of the Internet of Things device being offline; wherein the online and offline of the Internet of Things device refer to the online and offline states of the Internet of Things device on the APP; according to the log data, constructing a plurality of log groups from the foreground-entering log as the starting point to the most recent background-entering log or the last log of the application as the ending point, wherein the logs in each log group are arranged in chronological order, the first log of each log group is the foreground-entering log, the last log is the most recent background-entering log or the last log of the application, and the intermediate logs are online and offline logs of the Internet of Things device; for the Internet of Things device, acquiring time lengths satisfying the following conditions: a first time length formed by the difference between the timestamp of the offline log of the Internet of Things device and the timestamp of the foreground-entering log; a second time length formed by the difference between the timestamp of the offline log of the Internet of Things device and the timestamp of the online log of the Internet of Things device; a third time length formed by the difference between the timestamp of the background-entering log and the timestamp of the online log of the Internet of Things device; a fourth time length formed by the difference between the timestamp of the last log of the application and the timestamp of the online log of the Internet of Things device; determining the online time length of the Internet of Things device for the log group according to the first time length, the second time length, the third time length, and the fourth time length; summing the online time lengths of at least one log group corresponding to the Internet of Things device to obtain the total online time length of the Internet of Things device.

2. The method of claim 1, wherein, After obtaining the total online time length of the Internet of Things device by summing the online time lengths of at least one log group corresponding to the Internet of Things device, the method further comprises: acquiring the running time length of the application for each log group according to the timestamp of the foreground-entering log and the timestamp of the background-entering log in each log group; summing the running time lengths of the application for each log group to obtain the total running time length; acquiring the online proportion of the Internet of Things device according to the total online time length and the total running time length.

3. The method of claim 2, wherein, If the log data indicates that the application controls at least two Internet of Things devices, after acquiring the online proportion of the Internet of Things device according to the total online time length and the total running time length, the method further comprises: acquiring the average online time length according to the total online time length of each Internet of Things device; acquiring the average online proportion of the at least two Internet of Things devices according to the average online time length and the total running time length.

4. The method of claim 1, wherein, The step of acquiring the log data of the application comprises: acquiring the log data of the application according to a preset interface, the preset interface comprising application start and end flags.

5. An online duration processing device, characterized by, The method comprises the following steps: The acquisition module is configured to acquire log data of an application, the log data comprising a plurality of logs arranged in chronological order, each log being one of the following logs: a log of the application entering the foreground, a log of the application entering the background, a last log of the application, a log of an Internet of Things device controlled by the application being online, or a log of the Internet of Things device being offline; wherein the online and offline of the Internet of Things device refer to the online and offline states of the Internet of Things device on the APP; The processing module is configured to construct a plurality of log groups according to the log data, starting from the log of the application entering the foreground and ending at the log of the application entering the background most recently or the last log of the application, wherein the logs in each log group are arranged in chronological order, the first log of each log group is the log of the application entering the foreground, the last log is the log of the application entering the background most recently or the last log of the application, and the intermediate logs are the online and offline logs of the Internet of Things device; The output module is configured to acquire the online duration of the Internet of Things device according to each log group; The output module is specifically configured to acquire, for the Internet of Things device, a duration that satisfies the following conditions: a first duration formed by the difference between the timestamp of the offline log of the Internet of Things device and the timestamp of the log of the application entering the foreground; a second duration formed by the difference between the timestamp of the offline log of the Internet of Things device and the timestamp of the online log of the Internet of Things device; a third duration formed by the difference between the timestamp of the log of the application entering the background and the timestamp of the online log of the Internet of Things device; a fourth duration formed by the difference between the timestamp of the last log of the application and the timestamp of the online log of the Internet of Things device; determine the online duration of the Internet of Things device for the log group according to the first duration, the second duration, the third duration, and the fourth duration; sum the online durations of at least one log group corresponding to the Internet of Things device to obtain the total online duration of the Internet of Things device.

6. An electronic device, comprising: comprise: a processor, and a memory connected to the processor in communication; the memory stores computer-executable instructions; the processor executes the computer-executable instructions stored in the memory to implement the method of any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are executed by the processor to implement the method of any one of claims 1 to 4.

8. A computer program product comprising a computer program, characterized in that, The computer program, when executed by the processor, is configured to implement the method of any one of claims 1 to 4.

Citation Information

Patent Citations

  • Method and server for monitoring application online time

    CN106899457A

  • Electronic equipment and mobile application access retention duration statistical method and device

    CN108228433A

  • Method and device for acquiring user use duration

    CN110633255A