A method, an electronic device, and a readable storage medium for counting Internet access duration
By monitoring the duration of the connection between the application and the server, the problem of low statistical accuracy of Internet access time in the prior art is solved, and a more accurate measurement of user Internet access time and a better user experience is achieved.
Patent Information
- Application Number
- CN202310913329.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-07-24
- Publication Date
- 2025-05-30
- Estimated Expiration
- 2043-07-24
AI Technical Summary
The existing technology has low accuracy when counting the Internet time, and cannot correctly measure the actual Internet time of users.
By monitoring the duration of connection between the application and the server, accurately counting the user's Internet access time.
It can more accurately measure the length of users' actual network and improve users' experience in routing product services.
Smart Images

Figure CN117715099B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technologies, and in particular, to a method for counting Internet access duration, an electronic device, and a readable storage medium. Background Art
[0002] Electronic devices such as personal mobile phones and tablet computers can access the Internet by connecting to a router. The router can record the electronic devices connected to it and can count the Internet access duration of users, etc. The router can count the Internet access duration based on the duration of packet transmission. For example, after an application server receives a request from an application, it transmits a packet corresponding to the request to the application, and the duration between the start time and the end time of packet transmission is the Internet access duration of the application.
[0003] However, there is a certain difference between the Internet access duration counted based on the duration of packet transmission and the actual Internet access duration. For example, for a long video with a duration of 1 hour and an actual video buffering time of 10 minutes, in this case, since the packet transmission only takes 10 minutes, the Internet access duration counted by the router is 10 minutes. However, the user needs 1 hour to finish watching the video, and the actual Internet access duration is 1 hour. Therefore, the current method of counting Internet access duration based on the duration of packet transmission has low accuracy and cannot correctly measure the actual Internet access duration of users. Summary of the Invention
[0004] This application provides a method for counting Internet access duration, an electronic device, and a readable storage medium, which can more accurately measure the actual Internet access duration of users. The technical solutions are as follows:
[0005] In a first aspect, an embodiment of this application provides a method for counting Internet access duration. Communication is supported between a first device and a second device, and at least one application is installed on the first device. This method is applied to the second device and includes:
[0006] After detecting that a first application establishes a connection with a corresponding server, monitor the duration from the start of the connection establishment to the disconnection. The first application and the corresponding server transmit data through the second device, and the first application is any application among the at least one application that establishes a connection with the corresponding server;
[0007] Determine the Internet access duration of the first application according to the duration from the start of the connection establishment to the disconnection.
[0008] Based on the above technical solution, after a connection is established between the application and its corresponding server, this connection will persist throughout the entire process of the user using the application until the application stops being used, at which point the connection between the application and the corresponding server is disconnected. Therefore, by monitoring the duration from the establishment to the disconnection of the connection, the second device can accurately count the Internet access duration corresponding to the first application, more accurately measure the actual Internet access duration of the user, and enhance the user experience of using the routing product service.
[0009] In combination with the first aspect, the above method further includes: determining the Internet access duration corresponding to applications of the same type in at least one application and / or the Internet access duration corresponding to the first device according to the Internet access duration of the first application.
[0010] The first application that establishes a connection with the corresponding server may be one application or multiple applications. These multiple applications may belong to the same type or different types. Therefore, based on the connection corresponding to the first application, the second device can count the Internet access duration corresponding to each application, the Internet access duration corresponding to applications of the same type, and the Internet access duration corresponding to the first device. The Internet access duration corresponding to each application refers to the duration of the user accessing the Internet using each application separately. Applications of the same type belong to one service. The Internet access duration corresponding to applications of the same type refers to the comprehensive duration of the user accessing the Internet using a certain service. The Internet access duration corresponding to the first device refers to the duration of the user accessing the Internet using the first device.
[0011] In combination with the first aspect, in some implementation manners of the first aspect, after detecting that the first application establishes a connection with the corresponding server, the second device obtains at least one of the application identifier corresponding to the connection, the identifier of the application type, and the device identifier. Determining the Internet access duration of the first application according to the duration from the establishment to the disconnection of the connection includes: determining the Internet access duration of the first application according to the duration from the establishment to the disconnection of the connection and the application identifier corresponding to the connection.
[0012] Determining the Internet access duration corresponding to applications of the same type in at least one application and / or the Internet access duration corresponding to the first device according to the Internet access duration of the first application includes:
[0013] Determining the Internet access duration corresponding to applications of the same type in at least one application according to the Internet access duration of the first application and the identifier of the application type corresponding to the connection; and / or determining the Internet access duration corresponding to the first device according to the Internet access duration of the first application and the device identifier corresponding to the connection.
[0014] Each connection corresponds to an application identifier, an identifier of the application type, and a device identifier. The second device can determine the connections belonging to the same application based on the application identifier, and determine the Internet access duration of each application according to the duration from the start of establishment to disconnection of these connections. The second device can determine the connections belonging to the same service based on the identifier of the application type, and determine the Internet access duration of each service according to the duration from the start of establishment to disconnection of these connections. The second device can determine the connections belonging to the same device based on the device identifier, and determine the Internet access duration of each device according to the duration from the start of establishment to disconnection of these connections.
[0015] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, monitoring the duration from the start of establishment to disconnection of a connection includes: determining whether the connection is disconnected in each preset period; and monitoring the duration of the connection in each preset period when the connection is not disconnected.
[0016] The second device determines whether the connection is disconnected at regular intervals; when the connection is not disconnected, it monitors the duration of the connection in the current preset period, and when the connection is disconnected, the duration of the connection in the current preset period is 0, so as to determine the duration of the connection in each preset period.
[0017] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, determining the Internet access duration of the first application according to the duration from the start of establishment to disconnection of the connection includes: determining the Internet access duration of the first application according to the duration of the connection in each preset period.
[0018] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, determining the Internet access duration according to the duration of the connection in each preset period includes: determining the Internet access duration of the first application in the same preset period according to the durations of the connections corresponding to the first application in the same preset period; and adding up the Internet access durations of the first application in each preset period to obtain the Internet access duration corresponding to the first application.
[0019] It should be understood that at least one connection can be established between an application and its corresponding server. The second device can screen out the connections corresponding to the first application from all the connections, and after monitoring the durations of the connections corresponding to the first application in each preset period, determine the Internet access duration of the first application in the preset period according to the durations of the connections in the same preset period.
[0020] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, determining the Internet access duration of the first application within the same preset period includes: determining, as the Internet access duration of the first application within the same preset period, the maximum duration among the durations of each connection corresponding to the first application that last within the same preset period.
[0021] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, monitoring the duration that a connection lasts within each preset period includes:
[0022] Determining a first duration and a second duration, where the first duration is the maximum allowable survival duration of the connection, and the second duration is the remaining survival duration of the connection corresponding to the end moment of each preset period;
[0023] Determining the difference between the first duration and the second duration;
[0024] In the case where the difference is less than the preset period, determining the difference as the duration that the connection lasts within the corresponding preset period; or,
[0025] In the case where the difference is greater than or equal to the preset period, determining the duration of the preset period as the duration that the connection lasts within the corresponding preset period.
[0026] Combined with the first aspect and the above implementation manners, in some implementation manners of the first aspect, monitoring the duration that a connection lasts within each preset period includes:
[0027] Obtaining the flag bit corresponding to the connection in the current preset period;
[0028] In the case where the flag bit is the first flag bit, determining the duration that the connection lasts within the current preset period according to the difference between the first duration and the second duration, where the first duration is the maximum allowable survival duration of the connection, and the second duration is the remaining survival duration of the connection corresponding to the end moment of the current preset period; or,
[0029] In the case where the flag bit is the second flag bit, determining the duration of the preset period as the duration that the connection lasts within the current preset period.
[0030] Wherein, the first flag bit and the second flag bit are determined according to the duration that the connection lasts within the previous preset period of the current preset period, or the first flag bit and the second flag bit are determined according to the packets received on the connection.
[0031] In some implementation manners, the second device may obtain the moment when the connection starts to be established and the moment when it is disconnected, and determine the Internet access duration corresponding to each application, the Internet access duration corresponding to each service, and the Internet access duration corresponding to the device according to the moment when it starts to be established and the moment when it is disconnected.
[0032] In a second aspect, an embodiment of the present application provides an electronic device, including: one or more processors; one or more memories; the memory stores one or more programs, and when the one or more programs are executed by the processor, the electronic device executes any possible method in the first aspect above.
[0033] In a third aspect, an embodiment of the present application provides a device, which is included in an electronic device. The device has the function of implementing the behavior of the electronic device in the first aspect and the possible implementation manners of the first aspect. The function can be implemented by hardware or by hardware executing corresponding software. The hardware or software includes one or more modules or units corresponding to the above functions. For example, a display module or unit, a detection module or unit, a processing module or unit, etc.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which instructions are stored. When the instructions run on a computer, the computer executes the method described in the first aspect above.
[0035] In a fifth aspect, an embodiment of the present application provides a computer program product containing instructions. When the computer program product runs on a computer, the computer executes the method described in the first aspect above.
[0036] The technical effects obtained in the second, third, fourth, and fifth aspects above are similar to the technical effects obtained by the corresponding technical means in the first aspect, and will not be elaborated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 FIG. shows a schematic diagram of an application scenario provided by an embodiment of the present application;
[0038] Figure 2 FIG. shows a software structure block diagram of a router provided by an embodiment of the present application;
[0039] Figure 3 FIG. shows a schematic diagram of an interface provided by an embodiment of the present application;
[0040] Figure 4 FIG. shows another schematic diagram of an interface provided by an embodiment of the present application;
[0041] Figure 5 FIG. shows another schematic diagram of an interface provided by an embodiment of the present application;
[0042] Figure 6 FIG. shows another schematic diagram of an interface provided by an embodiment of the present application;
[0043] Figure 7 FIG. shows another software structure block diagram of a router provided by an embodiment of the present application;
[0044] Figure 8 Shows a schematic diagram for calculating connection duration provided by an embodiment of the present application;
[0045] Figure 9 Shows another schematic diagram for calculating connection duration provided by an embodiment of the present application;
[0046] Figure 10 Shows a schematic diagram of the structure of an electronic device provided by an embodiment of the present application;
[0047] Figure 11 Shows a software structure block diagram of an electronic device provided by an embodiment of the present application;
[0048] Figure 12 Shows a schematic diagram of the structure of a router provided by an embodiment of the present application. Detailed implementation manners
[0049] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings. Hereinafter, the terms "first" and "second" are only used for descriptive purposes and cannot be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, features defined with "first" and "second" may explicitly or implicitly include one or more of such features. In the description of this embodiment, unless otherwise specified, the meaning of "a plurality" is two or more.
[0050] Figure 1 Shows a schematic diagram of an application scenario involved in an embodiment of the present application. As Figure 1 shown, this scenario involves an electronic device 100 (the first device), a router 200 (the second device), and the Internet.
[0051] The electronic device 100 can be connected to the Internet in a wired or wireless manner. When the electronic device 100 is connected to the Internet in a wireless manner, it can be connected to the router 200 through wireless communication technology. The router 200 can be connected to the Internet through a network transmission medium (for example, optical fiber, coaxial cable, twisted pair, or radio wave), thereby enabling the electronic device 100 to implement Internet access functions (for example, watching online videos and playing online games). If the electronic device 100 has a wired network interface, the electronic device 100 can also be connected to the router 200 in a wired manner.
[0052] The router 200 is a hardware device that connects two or more networks and acts as a gateway between the networks for forwarding data packets in the network. Taking the user using Application A in an electronic device as an example, after the user clicks on Application A in the electronic device, the electronic device starts Application A in response to the user's click operation. Application A in the electronic device can establish communication with the server corresponding to Application A, and the data packets that need to be interactively transmitted between Application A and the server corresponding to Application A will be forwarded by the router. The data packets interacted between Application A and the server corresponding to Application A can be referred to as messages.
[0053] Among them, the wireless communication technologies include but are not limited to: wireless local area networks (WLAN), wireless fidelity (Wi-Fi) networks, Bluetooth (BT), 5th generation mobile networks or 5th generation wireless systems (abbreviated as 5G), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc.
[0054] Among them, the electronic device 100 can be a mobile phone, a tablet computer, a laptop computer, a smart watch, an ultra-mobile personal computer (UMPC), a personal digital assistant (PDA), a smart TV, a wearable electronic device, etc. The embodiments of the present application do not limit the type of the electronic device.
[0055] The principle of the router forwarding data packets will be described below. Figure 2 FIG. shows a schematic software structure diagram of a router provided by an embodiment of the present application.
[0056] When an electronic device accesses the Internet through a router, the electronic device encapsulates data into data packets and sends them to the WIFI port of the driver layer in the router; after the WIFI port receives the data packets sent by the electronic device, it can transmit the data packets to the protocol stack for unpacking. After unpacking and analysis by the protocol stack, the router can determine the target address corresponding to the data packet. After the router determines the target address corresponding to the data packet, it then determines the best route according to the routing algorithm and forwards it to the Internet through the network interface at the other end of the router, so that the data packet is transmitted to the target address. The router can also receive data packets from the Internet through the network interface and transmit the data packets to the protocol stack for unpacking. After unpacking and analysis by the protocol stack, it is forwarded to the electronic device through the WIFI port. Among them, the protocol stack includes a series of network protocols, such as the Transmission Control Protocol (TCP), Internet Protocol (IP), etc. The protocol stack defines how the electronic device connects to the Internet and the rules for how data is transmitted between networks.
[0057] It should be noted that an acceleration channel is set in the router. When the electronic device accesses the Internet and there are a large number of data packets in the sending queue, some data packets can be forwarded through the acceleration channel. The acceleration channel means that when the router forwards data packets, the data packets do not pass through the protocol stack but are directly forwarded from the driver at one end of the router to the driver at the other end. As Figure 2 shown, the data packet can be forwarded from the network interface at one end of the router to the WIFI port at the other end, or the data packet is forwarded from the WIFI port at one end of the router to the network interface at the other end, so as to transmit the data packet to the electronic device or the Internet. When the router forwards data packets, it reduces the processing of data packets by the protocol stack, reduces the processing load of the router, and can improve the data forwarding performance, thus achieving the purpose of accelerating network data.
[0058] In addition, an identification module is set in the protocol stack of the router. Among them, the identification module can parse each received data packet to identify the user's Internet access information. For example, the identification module can identify which service the user's Internet access information belongs to (for example, game category, video category) and which specific application in this category through parsing the data packet. For games, such as Honor of Kings, Peacekeeper Elite, etc., and for videos, such as Douyin, Kuaishou, iQIYI, etc. For data packets passing through the acceleration channel, the identification module can obtain the data packets through the callback module of the protocol stack and then parse the data packets.
[0059] The recognition module can also determine whether the device and applications are in use based on the network throughput rate (packets per second, pps), and calculate the Internet access duration of different services or applications according to the packet transmission time. The storage module can save the data parsed by the recognition module, such as the Internet access duration of a certain application, the Internet access duration of a certain type of service, etc.
[0060] After the recognition module parses the application information, it can preferentially process the packets of preset categories of applications and services. Exemplarily, when an electronic device connected to a router via WIFI plays games or takes online courses, the router will actively recognize the packets and mark the game packets and video packets. The WIFI driver puts the game packets and video packets into different priority transmission queues according to the packet marks, and accelerates the forwarding of the packets with higher priority, providing users with game acceleration and online course acceleration functions.
[0061] Processes at the application layer, such as the child protection process and the game acceleration process, can obtain the data in the storage module through the service process (fa process) to determine the Internet access duration of different services or applications. Exemplarily, the game acceleration process registers for the service statistics service with the service process. The game acceleration process can regularly obtain the acceleration duration from the service process, and the game acceleration process can give the acceleration duration to the electronic device, so that the electronic device can display the game acceleration duration.
[0062] That is to say, in addition to providing Internet access functions for electronic devices, the router can also provide functions for statistical Internet access information of electronic devices, such as statistical Internet access duration. The corresponding functions in the electronic device include functions such as child Internet access protection and game acceleration. Hereinafter, taking the electronic device as a mobile phone as an example, the child Internet access protection function and the game acceleration function in the electronic device will be specifically described.
[0063] Exemplarily, Figure 3 Shows a schematic diagram of the child Internet access protection function provided by the embodiment of the present application. The user can manage the router connected to the electronic device through the intelligent space application in the electronic device, can also see the Internet access duration of the child mobile phone, and can turn on the Internet access protection of the child mobile phone.
[0064] Figure 3In (a) is a schematic diagram of the main screen interface of an electronic device. The main screen interface may include an application icon display area for displaying icons of various types of applications (Apps), such as clock icon, calendar icon, gallery icon, memo icon, file management icon, email icon, music icon, calculator icon, video icon, sports health icon, weather icon, browser icon, smart life icon, settings icon, recorder icon, app store icon, camera icon, contacts icon, phone icon, message icon, etc. Above the application icon display area, a status bar may also be displayed, and the status bar may include: one or more signal strength indicators of mobile communication signals, one or more signal strength indicators of Wi-Fi signals, a power indicator of the electronic device, a time indicator, etc.
[0065] The electronic device can receive a click operation by the user on the Smart Space APP icon. In response to the user's click operation on the Smart Space APP icon, the electronic device can launch the Smart Space APP and display the main interface of the Smart Space APP as shown in Figure 3 (b). In the main interface of the Smart Space APP, all the devices added by the user to the Smart Space APP and the status of each device are displayed. For example, in the area 601 shown in Figure 3 (b), the TV located in the first room is displayed and the TV is in an online state; in the area 602, the TV located in the second room is displayed and the TV is in an online state; in the area 603, the smart projector located in the fourth room is displayed and the smart projector is in an offline state; in the area 604, the router located in the fourth room is displayed, the router name is "Honor Router Z3 Pro", and the router is in an online state.
[0066] The user can click on the above area 604 to view the detailed information of the router. In response to the user's click operation on the area 604, the electronic device can display the router management interface as shown in Figure 4 (a). The router management interface can display a heat map of the whole-house WLAN coverage. The user can edit the floor plan of the house to generate a heat map of the whole-house WLAN coverage. The router management interface can also display the network environment, the download rate and upload rate of the network. For example, the current network environment is good. The router management interface can also display options for multiple functions provided by the router, such as "Connected Devices" option, "Beta Ticket" option, "Parental Control" option, "Smart Detection" option, etc. The user can perform operations in the router management interface to manage the router.
[0067] When the user wants to view the Internet usage duration of the parental control, the user can click on the "Parental Control" option. In response to the user's click operation on the "Parental Control" option, the electronic device can display asFigure 4 The interface of the selection device shown in (b) in [description], which can display the devices using the child Internet protection function, such as the type and name of the device. In addition, the interface of the selection device also shows the devices that have been connected or connected to the router but have not enabled the child Internet protection. As Figure 4 shown in (b) in [description], the mobile phone "Honor V40 Light Luxury Edition" is using the child Internet protection function, and other devices such as Device 1, Device 2, and Device 3 have not enabled the child Internet protection function. The user can click the indicator on the right side of the device identifier to enter the detail page, enable or disable the child Internet protection for a certain device, or view more detailed Internet information.
[0068] For example, the user can click the indicator on the right side of the "Honor V40 Light Luxury Edition". In response to the user's click operation, the electronic device can display the detail page interface corresponding to the mobile phone "Honor V40 Light Luxury Edition" as shown in (a) in Figure 5 [description]. The detail page interface can display the Internet information (Internet usage duration / used applications, etc.) of the mobile phone "Honor V40 Light Luxury Edition" and the relevant settings for the Internet protection of the mobile phone "Honor V40 Light Luxury Edition". For example, the detail page interface shows the "One-key Disconnect" option. The user can click the "One-key Disconnect" option. In response to the user's click operation on the "One-key Disconnect" option, the electronic device sends a request to the router. After receiving the request, the router will disconnect the connection with the mobile phone "Honor V40 Light Luxury Edition" and prevent the mobile phone "Honor V40 Light Luxury Edition" from connecting to the Internet. The drop-down option box corresponding to the "One-key Disconnect" option can include multiple options such as disconnect immediately, disconnect after 10 minutes, disconnect after 30 minutes, and disconnect after 1 hour. The user can select one of them, and the router will disconnect the network of the mobile phone "Honor V40 Light Luxury Edition" after the corresponding time. The detail page interface also shows the "All Allowed" option. After enabling the "All Allowed", the protected device "Honor V40 Light Luxury Edition" will not be restricted by other rules (such as duration limit, time period limit, etc.) and will immediately resume Internet access.
[0069] The details page interface also displays content such as Internet access time statistics, allowed Internet access periods, allowed Internet access durations, and allowed Internet access applications. Specifically, users can set the time period during which the protected device is allowed to access the Internet. The protected device will not be able to access the Internet during the periods without configuration. For example, if the user sets that the device can access the Internet from 12:00 to 13:00 every day, the "Honor V40 Lite Edition" can access the Internet during the period from 12:00 to 13:00. Users can also set the duration for which the protected device is allowed to access the Internet. After the duration is exhausted, the protected device will not be able to access the Internet. The Internet access duration is only valid during the Internet access period. For example, if the user does not set the allowed Internet access period and only sets the maximum Internet access time for the protected device on Monday to be 6 hours, then after the protected device accesses the Internet for 6 hours throughout Monday, it will not be able to continue accessing the Internet. If the maximum Internet access time on Monday is set to 6 hours and Internet access is only allowed during the period from 8:00 to 23:00, then the protected device can access the Internet for a maximum of 6 hours only during the period from 8:00 to 23:00 on Monday. Users can also turn off or on the Internet access permissions for certain applications. For example, after turning on the game application switch, 23 applications in the corresponding application list are allowed to access the Internet.
[0070] Users can click on the indicator of the Internet access time statistics function. In response to the user's click operation, the electronic device can display the interface as shown in Figure 5 (b) of. In the Internet access time statistics function, the applications supported by the router are classified into five categories: learning, social, video, game, and others, and are statistically analyzed according to different time periods (such as yesterday, today, and this week). Users can respectively view the Internet access durations of the applications in each category on the protected device yesterday, today, and this week, as well as the Internet access situations of specific applications.
[0071] When the user wants to view the data after game acceleration, the user can click on the "More" option as shown in Figure 4 (a) of. In response to the user's click operation on the "More" option, the electronic device can display the interface as shown in Figure 6 (a) of. This interface displays more function options, such as online class acceleration, game acceleration, upgrade management, etc.
[0072] Users can set the game acceleration and can also obtain the acceleration information during "game acceleration". For example, the user can click on the "Game Acceleration" option displayed in the interface as shown in Figure 6 (a) of. In response to the user's click operation, the electronic device can display the "Game Acceleration" interface as shown in Figure 6 (b) of. In the "Game Acceleration" interface, the records of the router's game acceleration are displayed, such as the current time, acceleration duration, reduced packet loss rate, latency rate, etc.
[0073] Based on Figure 2When implementing the above Internet access information statistics function based on the principle, the router can count the Internet access duration according to the current generated traffic, that is, count the Internet access duration according to the duration of packet transmission. For example, after the application server receives a request from the application, it transmits the packet corresponding to the request to the application, and the duration between the start time and the end time of packet transmission is the Internet access duration of the application. The counted Internet access duration of the application is often considered as the actual Internet access duration of the user. However, for some applications, such as games, short videos, long videos, online courses, social networking, etc., during the use process, there may not be continuous packet transmission between the application and the application server throughout the connection process. Therefore, there is a certain difference between the Internet access duration counted according to the duration of packet transmission and the actual Internet access duration.
[0074] For example, when a user watches a long video with a duration of 1 hour, the actual video buffering time is 10 minutes, that is to say, the video data has been buffered in 10 minutes. After buffering, no traffic and no packet transmission will occur during video playback. In this case, since only 10 minutes of packet transmission is required, the Internet access duration counted by the router is 10 minutes. However, the user takes 1 hour to finish watching the video, and the actual Internet access duration is 1 hour. Another example is when a user swipes short videos on Douyin. The traffic of each short video may only need to be transmitted for 5 seconds, but it takes 1 minute to finish watching the short video. In this case, the Internet access duration counted by the router is 5 seconds, which is 8% of the actual usage duration. If the user is restricted to only watch 10 minutes of Douyin videos, then in fact, the duration of the user watching Douyin videos will be much longer than 10 minutes. The actual Internet access duration of the user may be longer than the Internet access duration counted by the router, which may cause the router to be unable to restrict the Internet access of the devices connected to the router (especially children's devices) according to the Internet access duration preset by the user. Another example is that a user plays the Peace Elite game for 1 hour, and only sees many intermittent (for example, about 30 seconds each) acceleration records in the game acceleration record, and no long-term game acceleration information is displayed, so that the user cannot see the real acceleration duration, which may reduce the user satisfaction.
[0075] In short, the method of counting the actual Internet access duration based on the duration of packet transmission has low accuracy and cannot correctly measure the actual Internet access duration of the user.
[0076] In view of this, the embodiments of the present application provide a method for counting the Internet access duration. At least one application is installed on the electronic device. After the user starts the first application, a connection will be established between the first application and the corresponding application server, and packets are transmitted between the first application and the application server through the router. After the router detects that the first application establishes a connection with the corresponding server, it monitors the duration from the start to the disconnection of the connection. The router determines the Internet access duration of the first application according to the duration from the start to the disconnection of the connection.
[0077] Based on the above calculation scheme, after a connection is established between the application and the corresponding server, this connection will persist throughout the entire process of the user using the application. This connection may have traffic at times and no traffic at other times, but the connection will always exist until the application stops being used, at which point the connection between the application and the corresponding server will be disconnected. Therefore, using the duration of the connection between the application and the corresponding server from the start of establishment to disconnection to determine the Internet access duration can more accurately count the required Internet access duration, more accurately measure the actual Internet access duration of the user, and enhance the user experience of using the routing product service.
[0078] Among them, the first application is any application among the at least one application that establishes a connection with the application server. The first application may be one application or multiple applications. These multiple applications may belong to the same type or different types. According to the Internet access duration of the first application, the Internet access duration corresponding to applications of the same type among the at least one application, and the Internet access duration corresponding to the electronic device can be determined.
[0079] As the user starts the application, opens different interfaces of the application, and uses different functions of the application, various connections (conntrack) will be established between the application and the corresponding server. For example, if Application 1 is installed on the electronic device, when the user uses Application 1 to chat, Application 1 can establish a connection related to chatting with the server; when the user uses Application 1 to watch a video, Application 1 can establish a connection related to the video with the server; when the user uses Application 1 for payment, Application 1 can establish a connection related to payment with the server.
[0080] Among them, the router uses the Linux system, and the router can monitor the duration from the start of connection establishment to disconnection through connection tracking (nf_conntrack). The connection tracking mechanism supported by the router is described below.
[0081] As the name implies, connection tracking is to track the connection. Its function is that after the connection is established, the router can identify the packets sent from the electronic device to the server or the packets sent from the server to the electronic device on a connection, record the information related to the connection, and save the connection status. A connection and a connection tracking are in one-to-one correspondence. One connection tracking is used to identify a connection between the client (a certain application on the electronic device used by the user, such as the Douyin client) and the corresponding server (such as the Douyin server).
[0082] Many packets (skb) are transmitted on a connection. A packet belongs to a connection, and the connection to which a packet belongs can be found through the packet. After receiving a packet, the router can parse the packet. If the packet does not belong to an existing connection, it means that the application is establishing a new connection. Then the router needs to create a new connection tracking, identify the information of the packet, and record a new connection-related information. If it is found that the packet belongs to an existing connection after parsing the packet, the connection-related information recorded through connection tracking is updated.
[0083] The connection-related information can include one or more of the following: basic information of the application and the server (such as five-tuple information, protocol type, source address, source port, destination address, destination port), application identifier, application type (service) identifier, connection lifetime, connection status, creation time, number of sent packets, network layer protocol, network layer protocol type code, transport layer protocol, transport layer protocol type code, number of sent bytes, etc. The connection-related information can be stored in a database, and the router can maintain and continuously update the database.
[0084] Exemplarily, a piece of information recorded by connection tracking can be: "ipv4, 2, tcp, 6, 192, ESTABLISHED, src = 192.168.3.3, dst = 101.91.33.146, sport = 53332, dport = 7889, src = 101.91.33.146, dst = 192.168.3.3, sport = 7889, dport = 53332, sc_id = 100, sc_categ = 4".
[0085] Among them, the network layer protocol is Internet Protocol Version 4 (ipv4), the protocol type code of ipv4 is 2, the transport layer protocol is the tcp protocol, the protocol type code of tcp is 6, the connection lifetime is 192s, the connection status is ESTABLISHED, src represents the source address, dst represents the destination address, sport represents the source port, and dport represents the destination port.
[0086] Suppose the port of the electronic device is "53332", the port of the server of Application A is "7889", the IP address of the electronic device is 192.168.3.3, and the IP address of the server of Application A is 101.91.33.146. That is, a terminal with the IP address 192.168.3.3 connects to a terminal with the IP address 101.91.33.146 and port 7889 through port 53332 using the TCP protocol. When the electronic device sends a message to the server, the source address src is 192.168.3.3, the source port sport is 53332, the destination address dst is 101.91.33.146, and the destination port dport is 7889. When the server sends a message to the electronic device, the source address src is 101.91.33.146, the source port sport is 7889, the destination address dst is 192.168.3.3, and the destination port dport is 53332.
[0087] In addition, the sc_id field represents the application identifier, which is used to determine which application the connection belongs to. The sc_categ field represents the application type, which is used to determine which service the connection belongs to. Each application in the electronic device can be represented by an application identifier (Identity document, id), and the specific application identifier information is not limited. For example, each application can be numbered in advance, and the number can be used as the corresponding id. For example, the numbers of Application 1, Application 2, Application 3, Application 4, and Application 5 can be 100, 200, 301, 401, and 804 respectively.
[0088] Multiple applications in the electronic device can be divided into different types. One type of application corresponds to one service (categ). Services can be divided into video, games (such as Honor of Kings, Peacekeeper Elite, Dou Di Zhu Every Day, etc.), learning (such as Xuexitong, Zuoyebang, etc.), social (such as WeChat, QQ, Weibo, etc.), shopping (such as Taobao, Jingdong, Hema, etc.), live broadcast, online courses, and others. Different services can be represented by identifiers, and the specific information used as identifiers is not limited. For example, corresponding numbers can be set for each service in advance, and the numbers can be used as the corresponding identifiers. For example, the numbers of video, games, and learning can be 1, 2, and 3 respectively.
[0089] The connection status can include ESTABLISHED and others (such as TIME_WAIT). When the user uses the application to access the Internet, the connection is in the in-use state, which is represented by ESTABLISHED in the recorded information. After the application exits the background, the connection is in the disconnected state, which is represented by TIME_WAIT in the recorded information. When calculating the Internet access duration, the connection with the status of ESTABLISHED is used for calculation.
[0090] The connection survival duration, which can also be referred to as the attenuation duration, has an initial survival duration when a new connection is established, that is, the maximum allowable survival duration of the connection. The survival duration decreases by 1 second every second. Every time a new packet on this connection is received, the survival duration is reset to the initial value. For example, the initial survival duration corresponding to a connection using the TCP protocol can be 432000 seconds.
[0091] Based on the five-tuple information, the router can determine the total Internet access duration of each device from the device dimension. Since the private fields sc_id and sc_categ are added in the connection tracking in the embodiments of the present application, the router can also count the Internet access duration of each application in the electronic device from the application dimension through sc_id, and count the Internet access duration of each service in the electronic device from the service dimension through sc_categ.
[0092] Figure 7 The schematic diagram of the principle of a router provided by the embodiments of the present application is shown. The following combines Figure 7 to introduce the principle of the router forwarding packets and counting the Internet access duration.
[0093] When the mobile phone accesses the Internet through the router, the mobile phone encapsulates the data into packets and sends them to the WIFI port of the driver layer in the router; after the WIFI port receives the packets sent by the mobile phone, it can transmit the packets to the protocol stack for unpacking. After unpacking and analyzing by the protocol stack, the router can determine the destination address corresponding to the packets. After the router determines the destination address corresponding to the packets, it then determines the best route according to the routing algorithm and forwards it to the Internet through the network port at the other end of the router, so that the packets are transmitted to the destination address. The router can also receive the packets from the Internet through the network port, transmit the packets to the protocol stack for unpacking, and forward them to the mobile phone through the WIFI port after unpacking and analyzing by the protocol stack.
[0094] Among them, the protocol stack defines how an electronic device connects to the Internet and the rules for how data is transmitted between networks. The protocol stack includes a series of network protocols, such as the Transmission Control Protocol (TCP), Internet Protocol (IP), Hyper Text Transfer Protocol (HTTP), File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), User Datagram Protocol (UDP), Address Resolution Protocol (ARP), and routing protocols.
[0095] It should be noted that an acceleration channel is set in the router. When the mobile phone is surfing the Internet and there are a large number of data packets in the sending queue, some data packets can be forwarded through the acceleration channel. The acceleration channel means that when the router forwards a data packet, the data packet does not pass through the protocol stack but is directly forwarded from the driver at one end of the router to the driver at the other end. As Figure 7 shown, the data packet can be forwarded from the network port at one end of the router to the WIFI port at the other end, or the data packet can be forwarded from the WIFI port at one end of the router to the network port at the other end to transmit the data packet to the mobile phone or the Internet. When the router forwards a data packet, it reduces the processing of the data packet by the protocol stack, reduces the processing load of the router, and can improve the data forwarding performance, thus achieving the purpose of accelerating network data.
[0096] An identification module is set in the protocol stack of the router. Among them, after the router receives a packet, the identification module can parse the packet to identify which type of service the packet belongs to and which specific application it belongs to. Then, the application identifier and service identifier are recorded in the relevant information of the connection to which the packet belongs. Thus, when counting the Internet access duration based on the information obtained from connection tracking, the corresponding Internet access duration can be counted from the service dimension and the application dimension. It should be noted that after the identification module identifies the application identifier and service identifier in the first packet of a connection or in a certain packet, the packets on this connection subsequently are no longer identified for applications and services, that is, it is not necessary to identify each packet, which reduces the workload of the identification module, reduces the processing load of the router, and can improve the performance of the router.
[0097] Each piece of connection-related information for connection tracking records is stored in the database ( / proc / nrt / nf_conntrack). The manager (cms process) can obtain connection-related information from the database at a preset period, and count the Internet access duration from the device dimension, application dimension, and service dimension respectively according to the connection-related information. In the embodiments of the present application, the duration of the preset period is not limited. For example, the preset period can be 10s, and the cms process counts the Internet access duration from the device dimension, application dimension, and service dimension every 10s, and writes the counted Internet access duration into the storage module ( / proc / atp_sc / xxx_stats). The data of the three dimensions can be saved in three files respectively.
[0098] Exemplarily, the specific content of the file / var / serv_stats corresponding to the application dimension can be in the form of a table, as shown in Table 1. Among them, the index column is the application identifier. For example, 401 is Application 4, and 804 is Application 5. This application identifier is negotiated by the electronic device, the application, and the router. When the electronic device receives the Internet access duration corresponding to the identifier 401, it can display the Internet access duration of Application 4 on the corresponding function interface. The active state Active indicates whether the application is accessing the Internet. If the Internet access has stopped, it is recorded as Active = 0, and if it is accessing the Internet, it is recorded as Active = 1. The Internet access duration is updated every 10s. If the application is accessing the Internet, the Internet access duration is increased by 1 every 10s. If the application stops accessing the Internet, the Internet access duration is not updated. For example, at the 100th second, it is detected that Application 5 stops accessing the Internet, and the Internet access duration stays at 80s. At the 500th second, after it is detected that Application 5 accesses the Internet again, and the Internet access duration in the period from 490s to 500s is 7s, then at the 500th second, 80s is updated to 87s. The service dimension and the device dimension are similar to the application dimension. The index column in the file / var / categ_stats corresponding to the service dimension can be the number of the service. In the file / var / host_stats corresponding to the device dimension, the index column can be the device number, such as D2:09:7A:32:00:73.
[0099] It should be noted that regardless of which dimension, a new table can be generated at zero o'clock every day to record the Internet access duration of the day. The table has a storage time limit, and the storage time limit can be 7 days, 14 days, 30 days, etc. For example, if the storage time limit is 7 days, then a table will be deleted 7 days after it is created to save the memory of the router. Or, record the value of the Internet access duration at the zero o'clock moment to determine the Internet access duration of each day.
[0100] Table 1 Internet access duration of each application
[0101]
[0102] For the data packets passing through the acceleration channel, the recognition module can obtain the data packets through the callback module of the protocol stack, and then parse the data packets. After the recognition module parses the Internet access information, it can preferentially process the packets of preset categories of applications and services. Exemplarily, when a mobile phone accessing the router via WIFI plays games or takes online courses, the router will actively recognize the packets and mark the game packets and video packets. The wifi driver puts the game packets and video packets into different-priority transmission queues according to the packet marks, and accelerates the forwarding of the packets with higher priority, providing users with game acceleration and online course acceleration functions.
[0103] Processes at the application layer, such as the child protection process and the game acceleration process, can obtain data in the storage module through the service process (fa process) to determine the Internet access duration of different services or different applications. Exemplarily, the game acceleration process registers for the service statistics service with the service process, and the service process can regularly send the acceleration duration to the game acceleration process, and the game acceleration process can give the acceleration duration to the mobile phone, so that the mobile phone can display the game acceleration duration. For example, the service process obtains the incremental statistical data of applications / services and the service activity information from the storage module every 30 seconds. The child protection process obtains the incremental Internet access data of the device / applications / services from the storage module every 2 minutes.
[0104] Taking the first application including Application 1 as an example below, the Internet access duration statistics method will be described from the application dimension.
[0105] After a connection is established between Application 1 and the corresponding server, the cms process can obtain the information related to the connection described above, monitor the duration from the start to the end of the connection according to the information related to the connection, and then determine the Internet access duration corresponding to Application 1 according to the duration from the start to the end of the connection. It should be understood that there is at least one connection established between Application 1 and the corresponding server, and the cms process filters out at least one connection corresponding to Application 1 from the database through the application identifier.
[0106] In one implementation, for each connection, the router records the moment when the connection starts to be established (the first moment), and records the moment when the connection is disconnected (the second moment). According to the multiple first moments and multiple second moments corresponding to the multiple connections, the union of the durations of the multiple connections is determined, and then the Internet access duration corresponding to Application 1 is determined. The first moment and the second moment, as the information related to the connection, can be stored in the database.
[0107] Exemplarily, Application 1 corresponds to Connection 1, Connection 2, and Connection 3. The first and second moments of Connection 1 are 13:00 and 15:00 respectively, the first and second moments of Connection 2 are 08:00 and 14:00 respectively, and the first and second moments of Connection 3 are 19:00 and 20:00 respectively. Then the union is 08:00 - 15:00 plus 19:00 - 20:00, and the Internet access duration corresponding to Application 1 is 8 hours.
[0108] When the user enters the function interface as Figure 5 and Figure 6 shown, the electronic device can request the router to obtain the Internet access duration. The router can determine whether all the connections of Application 1 are disconnected. If all the connections of Application 1 are disconnected, the disconnection moment of each connection is the second moment; if the connections of Application 1 are not disconnected, the current moment is determined as the second moment of the non-disconnected connection; the continuous duration of multiple connections is determined according to the first moment and the second moment, and then the current Internet access duration of Application 1 is determined. The router sends the Internet access duration of Application 1 to the electronic device, and the electronic device displays the Internet access time.
[0109] Alternatively, regardless of whether the electronic device requests to obtain the Internet access duration, the router can count the Internet access duration every day or every week. For example, the router monitors the Internet access duration of Application 1 at regular intervals. The length of the time interval can be 30 minutes, 1 hour, 2 hours, etc. When monitoring, the first moment and the second moment corresponding to Application 1 can be determined. Among them, if all the connections of Application 1 are disconnected, the disconnection moment of each connection is the second moment; if the connections of Application 1 are not disconnected, the current moment is determined as the second moment of the non-disconnected connection.
[0110] When the user sets the maximum Internet access duration, the router can monitor the earliest first moment corresponding to Application 1, and monitor whether the Internet access duration of Application 1 reaches the maximum Internet access duration at regular intervals. When the maximum Internet access duration is reached, Application 1 is prohibited from accessing the Internet; if the maximum Internet access duration is not reached, the monitoring continues. The length of the time interval can be determined according to the maximum Internet access duration. For example, if the maximum Internet access duration is 6 hours, the length of the time interval can be 1 hour, 2 hours, etc. The router can calculate the remaining Internet access duration of Application 1 during each monitoring, and continuously reduce the length of the time interval according to the remaining Internet access duration. For example, if the maximum Internet access duration is 6 hours and the remaining Internet access duration is 6 hours, the length of the time interval can be 6 hours; if the remaining Internet access duration is 1 hour, the length of the time interval can be 20 minutes.
[0111] If the Internet access duration of each day is counted, the first moment and the second moment can be determined within the time of one day (00:00 - 24:00) according to the natural day. If the Internet access duration of each week is counted, the first moment and the second moment can be determined within the time of one week (for example, from 00:00 on Monday to 24:00 on Sunday).
[0112] It should be understood that the Internet access duration can also be determined in this way for the service dimension and the device dimension, which will not be elaborated hereinafter.
[0113] In another implementation manner, first, a preset period is determined. For example, if the preset period is 10 s, then the cms process determines the Internet access duration of Application 1 in one preset period at the 10th s, 20th s, 30th s, and so on. Specifically, at each preset period node, the duration that each connection lasts in each preset period is calculated. According to the duration that each connection lasts in the same preset period, the Internet access duration of Application 1 in one preset period is determined, and the Internet access durations of each preset period are added together to obtain the Internet access duration corresponding to Application 1. Counting the Internet access duration according to the period can more timely determine the Internet access duration of each dimension, display it in the interface of the electronic device in a timely manner, and implement the limitation of the Internet access duration.
[0114] For the duration that a connection lasts in one preset period, in one implementation manner, at each period node, the duration that the connection lasts in the preset period is determined according to the first duration and the second duration. Among them, the first duration is the initialized survival duration of the connection, that is, the maximum allowable survival duration, and the second duration is the remaining survival duration corresponding to the end moment of the preset period of the connection. Specifically, the cms process calculates the difference between the first duration and the second duration. If the difference is less than the preset period, the duration that the connection lasts in the preset period is the duration corresponding to the difference. If the difference is greater than or equal to the preset period, the duration that the connection lasts in the preset period is the duration of one period.
[0115] Exemplarily, as Figure 8 shown, Application 1 corresponds to Connection 1 and Connection 2. Connection 1 is established at the 15th s, and Connection 2 is established at the 2nd s. The initialized connection survival time is 200 s. For Connection 1, when counting the Internet access duration at the 20th s, the connection survival duration decays to 195 s. Then, the first duration minus the second duration is equal to 5 s, and 5 s < 10 s. Therefore, in the period from 10 s to 20 s, the duration that Connection 1 lasts is 5 s. For Connection 2, when counting the Internet access duration at the 20th s, the connection survival duration decays to 182 s. Then, the first duration minus the second duration is equal to 18 s, and 18 s > 10 s. Therefore, in the period from 10 s to 20 s, the duration that Connection 2 lasts is 10 s.
[0116] In another implementation, the duration for which a connection persists within a cycle is determined based on the connection's flag bit (active). At each cycle node, the current flag bit of the connection is obtained. When the flag bit is the first flag bit (active = 0), the duration for which the connection persists within the current preset cycle is determined based on the difference between the first duration and the second duration. When the flag bit is the second flag bit (active = 1), the duration of the preset cycle is determined as the duration for which the connection persists within the current preset cycle. By setting the flag bit, the duration for which a connection persists within a cycle can be determined more accurately.
[0117] In one implementation, the first flag bit and the second flag bit can be determined based on the packets received on the connection. When a new connection is established, the initial flag bit is set to active = 0. When a new packet is received on this connection, the flag bit is set to active = 1.
[0118] In another implementation, the first flag bit and the second flag bit can be determined based on the duration for which the connection persisted within the previous preset cycle of the current preset cycle. If the duration for which it persisted within the previous preset cycle was 0, then active = 0. If the duration for which it persisted within the previous preset cycle was greater than 0, then active = 1. Specifically, after the router receives a packet and finds that there is no corresponding connection in the database, a new connection is established. When a new connection is established, the initial flag bit is set to active = 0. At the statistical node, the connections with the status of ESTABLISHED among all the connections corresponding to the application are filtered out. If the active of the connection is 0, the duration for which the connection persists within the cycle is the difference between the first duration and the second duration. If the difference is greater than 0, then the active of the connection is updated to 1. If the active of the connection is 1, the duration for which the connection persists within the cycle is the cycle length. After determining the duration for which the connection persists within the cycle, the active status of all the connections corresponding to the application is updated. For connections with other statuses except ESTABLISHED, it is updated to active = 0. The flag bit, as information related to the connection, can be stored in the database.
[0119] Exemplarily, such as Figure 8As shown, connection 1 is established at the 15th second, and connection 2 is established at the 2nd second. When the Internet access duration is counted at the 20th second, the statuses of both connection 1 and connection 2 are ESTABLISHED. For connection 1, active = 0, and for connection 2, active = 1. Therefore, within the period from the 10th second to the 20th second, the duration of connection 1 is 5 seconds, and the duration of connection 2 is 10 seconds. Then, the active of connection 1 is updated to 1, and the active of connection 2 remains 1. When the Internet access duration is counted at the 30th second, the statuses of both connection 1 and connection 2 are ESTABLISHED. For connection 1, active = 1, and for connection 2, active = 1. Therefore, within the period from the 20th second to the 30th second, the durations of both connection 1 and connection 2 are 10 seconds, and the updated active is still 1. When the Internet access duration is counted at the 40th second, the status of connection 1 has changed to the TIME_WAIT state. Therefore, within the period from the 30th second to the 40th second, the duration of connection 1 is 0 seconds, and then the active of connection 1 is updated to 0. The status of connection 2 is still ESTABLISHED, and for connection 2, active = 1. Within the period from the 30th second to the 40th second, the duration of connection 2 is 10 seconds, and the updated active is still 1. If connection 1 is reused later, the active status of the connection can be updated, and the duration of connection 1 can be calculated.
[0120] After calculating the duration that each connection lasts in each period, within a statistical period, compare the multiple durations obtained in this period, and determine the longest duration as the Internet access duration of Application 1 in this statistical period. Add up the Internet access durations of Application 1 in each statistical period to obtain the actual Internet access duration of Application 1.
[0121] Exemplarily, as Figure 9 shown, the connections corresponding to Application 1 include: connection 1, connection 2, connection 3, connection 4, and connection 5. Connection 1 is established at the 15th second, connection 2 is established at the 2nd second, connection 3 is established at the 13th second, connection 4 is established at the 11th second, and connection 5 is established at the 6th second. Within the period from the 0th second to the 10th second, the duration of connection 2 is 8 seconds, and the duration of connection 5 is 4 seconds. Since 8 seconds > 4 seconds, the Internet access duration of Application 1 within the period from the 0th second to the 10th second is 8 seconds. Within the period from the 10th second to the 20th second, the duration of connection 1 is 5 seconds, the duration of connection 2 is 10 seconds, the duration of connection 3 is 7 seconds, the duration of connection 4 is 9 seconds, and the duration of connection 5 is 10 seconds. Therefore, the Internet access duration of Application 1 within the period from the 10th second to the 20th second is 10 seconds. Similarly, the Internet access duration of Application 1 within the period from the 20th second to the 30th second is 10 seconds. Within the duration from the 0th second to the 30th second, the Internet access duration of Application 1 is 8 seconds + 10 seconds + 10 seconds = 28 seconds.
[0122] For the service dimension, at least one application corresponds to one type of service. For example, in the game service category, there are Application 1 and Application 2. The connections corresponding to Application 1 include Connection 1 to Connection 5, and the connections corresponding to Application 2 include Connection 6 and Connection 7. The router obtains all connection-related information (such as the information of Connection 1 to Connection 7) corresponding to a certain type of service (such as the game service category) from the database according to the service identifier, monitors the duration of the connection from the start of establishment to the end, and then determines the Internet access duration corresponding to a certain type of service according to the duration of the connection from the start of establishment to the end. The specific calculation method is similar to that of the application dimension. Exemplarily, the duration of each connection in each cycle can be calculated by the implementation method in the above application dimension. In a statistical cycle, compare the multiple durations obtained in this cycle, and determine the longest duration as the Internet access duration of this type of service in this statistical cycle. Add up the Internet access durations of this type of service in each statistical cycle to obtain the actual Internet access duration of this type of service.
[0123] For the device dimension, the router can be connected to multiple electronic devices, and at least one application is installed on one electronic device. The router can obtain all connection-related information corresponding to the first electronic device from the database according to the five-tuple information (such as the source address), monitor the duration of the connection from the start of establishment to the end, and then determine the Internet access duration corresponding to the first electronic device according to the duration of the connection from the start of establishment to the end. The specific calculation method is similar to that of the application dimension. Exemplarily, the duration of each connection in each cycle can be calculated by the implementation method in the above application dimension. In a statistical cycle, compare the multiple durations obtained in this cycle, and determine the longest duration as the Internet access duration of the first electronic device in this statistical cycle. Add up the Internet access durations of the first electronic device in each statistical cycle to obtain the actual Internet access duration of the first electronic device.
[0124] In one implementation, the Internet access duration of the application can be calculated first, and then the Internet access duration of the service and the first electronic device can be calculated. Exemplarily, for the service dimension / device dimension, in a statistical cycle, compare the multiple Internet access durations of the applications obtained in this cycle, and determine the longest Internet access duration as the Internet access duration of this type of service or the first electronic device in this statistical cycle. Then add up the Internet access durations in each statistical cycle to obtain the total Internet access duration. For example, the first electronic device installs Application 1 and Application 2, and both Application 1 and Application 2 are in the game service category. In the 0s - 10s cycle, the Internet access duration of Application 1 is 8s, and the Internet access duration of Application 2 is 10s. Then in the 0s - 10s cycle, the Internet access duration of the game service category is 10s, and the Internet access duration of the first electronic device is 10s.
[0125] It should be noted that in some scenarios, a router is connected to an electronic device, and an application is installed in the electronic device. When counting the Internet access duration, the router does not need to obtain the application identifier, service identifier, and device identifier information.
[0126] Based on the above method, when the user watches a video for 1 hour, the Internet access duration for the video can be displayed as 1 hour in the Figure 5 shown interface. When the user plays a game for 10 minutes, the game acceleration duration can be displayed as 10 minutes in the Figure 6 interface shown in (b) of
[0127] In summary, in the embodiment of the present application, by modifying the Linux native connection tracking nf_conntrack, the connection between the application client and the application server can be associated with specific services and applications, and the Internet access duration can be counted respectively from the device dimension, service dimension, and specific application dimension. The router records the relevant information of the entire process of communication between the application client and the application server through connection tracking, and counts the Internet access duration according to the time when the connection between the client and the server is maintained. After the connection is established, the connection status can be determined every 10s. If the connection status is not disconnected, the Internet access duration can be increased. If the connection is disconnected, the statistics of the Internet access duration stops. Based on the method provided in the embodiment of the present application, the router can accurately count the Internet access duration of the electronic device, the Internet access duration of the service, and the Internet access duration of the application. Therefore, the electronic device can accurately display the Internet access duration of the device, as well as the game and online course acceleration durations, etc. on the app, improving the user experience of using the routing product service, which belongs to a general solution.
[0128] The following introduces the schematic diagram of the hardware structure of the electronic device 100 that can implement the method provided in the present application. Exemplarily, Figure 10 shows a schematic diagram of a hardware structure of the electronic device 100 provided in the embodiment of the present application.
[0129] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0130] It can be understood that the structure schematically shown in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0131] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0132] Among them, the controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0133] A memory can also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can hold the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the said memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0134] In some embodiments, the processor 110 may include one or more interfaces. The interfaces may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0135] The I2C interface is a bidirectional synchronous serial bus, including a serial data line (SDA) and a serial clock line (SCL). In some embodiments, the processor 110 may include multiple groups of I2C buses. The processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193, etc. through different I2C bus interfaces. For example: The processor 110 can be coupled to the touch sensor 180K through the I2C interface, enabling the processor 110 to communicate with the touch sensor 180K through the I2C bus interface to implement the touch function of the electronic device 100.
[0136] The I2S interface can be used for audio communication. In some embodiments, the processor 110 may include multiple groups of I2S buses. The processor 110 can be coupled to the audio module 170 through the I2S bus to achieve communication between the processor 110 and the audio module 170. In some embodiments, the audio module 170 can transmit an audio signal to the wireless communication module 160 through the I2S interface to implement the function of answering a phone call through a Bluetooth headset.
[0137] The PCM interface can also be used for audio communication to sample, quantize, and encode analog signals. In some embodiments, the audio module 170 and the wireless communication module 160 can be coupled through the PCM bus interface. In some embodiments, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface to implement the function of answering calls through a Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
[0138] The UART interface is a general-purpose serial data bus for asynchronous communication. This bus can be a two-way communication bus. It converts the data to be transmitted between serial communication and parallel communication. In some embodiments, the UART interface is typically used to connect the processor 110 and the wireless communication module 160. For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In some embodiments, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface to implement the function of playing music through a Bluetooth headset.
[0139] The MIPI interface can be used to connect the processor 110 to peripheral devices such as the display screen 194 and the camera 193. The MIPI interface includes a camera serial interface (CSI), a display serial interface (DSI), etc. In some embodiments, the processor 110 and the camera 193 communicate through the CSI interface to implement the shooting function of the electronic device 100. The processor 110 and the display screen 194 communicate through the DSI interface to implement the display function of the electronic device 100.
[0140] The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or a data signal. In some embodiments, the GPIO interface can be used to connect the processor 110 to the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, etc. The GPIO interface can also be configured as an I2C interface, an I2S interface, a UART interface, a MIPI interface, etc.
[0141] The USB interface 130 is an interface that conforms to the USB standard specification and can specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used for data transmission between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as AR devices, etc.
[0142] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are only illustrative descriptions and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0143] The charging management module 140 is configured to receive a charging input from a charger. The charger may be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 may receive the charging input from the wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 may receive the wireless charging input through the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 may also supply power to the electronic device through the power management module 141.
[0144] The power management module 141 is configured to connect to the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives the inputs from the battery 142 and / or the charging management module 140 and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, etc. The power management module 141 may also be used to monitor parameters such as the battery capacity, the number of battery charge cycles, and the battery health status (leakage, impedance). In some other embodiments, the power management module 141 may also be disposed in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may also be disposed in the same device.
[0145] The wireless communication function of the electronic device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0146] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 may be used to cover a single or multiple communication frequency bands. Different antennas may also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 may be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna may be used in combination with a tuning switch.
[0147] The mobile communication module 150 may provide solutions for wireless communications such as 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 may receive electromagnetic waves through the antenna 1, filter and amplify the received electromagnetic waves, and then transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 may also amplify the signal modulated by the modulation and demodulation processor and convert it into electromagnetic waves through the antenna 1 for radiation. In some embodiments, at least some functional modules of the mobile communication module 150 may be provided in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be provided in the same device.
[0148] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.
[0149] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), and the like. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 may also receive signals to be sent from the processor 110, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna 2 for radiation.
[0150] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, such that electronic device 100 can communicate with a network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0151] Electronic device 100 implements a display function through a GPU, display screen 194, and an application processor, etc. The GPU is a microprocessor for image processing, and is connected to display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or change display information.
[0152] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0153] The electronic device 100 can implement the shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, an application processor, etc.
[0154] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and light passes through the lens and is transmitted to the camera photosensitive element. The optical signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also optimize the noise, brightness, and skin color of the image through algorithms. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0155] The camera 193 is used to capture static images or videos. An object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard format such as RGB or YUV. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0156] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.
[0157] The video codec is used to compress or decompress digital video. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple coding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0158] The NPU is a neural-network (NN) computing processor. By learning from the biological neural network structure, such as learning from the transmission mode between human brain neurons, it can quickly process the input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as: image recognition, face recognition, speech recognition, text understanding, etc.
[0159] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement the data storage function. For example, files such as music and videos are saved in the external memory card.
[0160] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store an operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.). The data storage area can store data created during the use of the electronic device 100 (such as audio data, phone book, etc.). In addition, the internal memory 121 can include high-speed random access memory, and can also include non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121, and / or the instructions stored in the memory provided in the processor.
[0161] The electronic device 100 can implement audio functions through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor, etc. For example, music playback, recording, voice calls, video calls, etc.
[0162] The audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some functional modules of the audio module 170 can be disposed in the processor 110.
[0163] The speaker 170A, also known as the "loudspeaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or hands-free calls through the speaker 170A.
[0164] The receiver 170B, also known as the "earpiece", is used to convert an audio electrical signal into a sound signal. When the electronic device 100 answers a call or a voice message, the voice can be listened to by placing the receiver 170B close to the human ear.
[0165] The microphone 170C, also known as the "microphone" or "transmitter", is used to convert a sound signal into an electrical signal. When making a call or sending a voice message, the user can speak by bringing the mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In some other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also implement a noise reduction function. In some other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the sound source, and implement functions such as directional recording.
[0166] The headphone jack 170D is used to connect a wired headphone. The headphone jack 170D can be a USB interface 130, or a 3.5 mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0167] The pressure sensor 180A is used to sense pressure signals and can convert pressure signals into electrical signals. In some embodiments, the pressure sensor 180A may be disposed on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. The capacitive pressure sensor may include at least two parallel plates having conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The electronic device 100 can also calculate the position of the touch according to the detection signal of the pressure sensor 180A. In some embodiments, touch operations acting on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example: when a touch operation with a touch operation intensity less than the first pressure threshold acts on the short message application icon, the instruction to view the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
[0168] The gyroscope sensor 180B can be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (i.e., the x, y, and z axes) can be determined by the gyroscope sensor 180B. The gyroscope sensor 180B can be used for anti-shake during shooting. Exemplarily, when the shutter is pressed, the gyroscope sensor 180B detects the angle of jitter of the electronic device 100, calculates the distance that the lens module needs to compensate according to the angle, and enables the lens to offset the jitter of the electronic device 100 through reverse movement to achieve anti-shake. The gyroscope sensor 180B can also be used for navigation and somatosensory game scenarios.
[0169] The barometric pressure sensor 180C is used to measure barometric pressure. In some embodiments, the electronic device 100 calculates the altitude according to the barometric pressure value measured by the barometric pressure sensor 180C to assist in positioning and navigation.
[0170] The magnetic sensor 180D includes a Hall sensor. The electronic device 100 can use the magnetic sensor 180D to detect the opening and closing of the flip leather case. In some embodiments, when the electronic device 100 is a flip phone, the electronic device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Furthermore, according to the detected opening and closing state of the leather case or the opening and closing state of the flip, features such as automatic flip unlocking are set.
[0171] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0172] A distance sensor 180F is used to measure distance. The electronic device 100 can measure distance through infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure distance to achieve fast focusing.
[0173] The proximity light sensor 180G may include, for example, a light-emitting diode (LED) and a light detector, such as a photodiode. The light-emitting diode may be an infrared light-emitting diode. The electronic device 100 emits infrared light outward through the light-emitting diode. The electronic device 100 uses the photodiode to detect the infrared reflected light from nearby objects. When sufficient reflected light is detected, it can be determined that there is an object near the electronic device 100. When insufficient reflected light is detected, the electronic device 100 can determine that there is no object near the electronic device 100. The electronic device 100 can use the proximity light sensor 180G to detect when the user holds the electronic device 100 close to the ear for a call, so as to automatically turn off the screen to save power. The proximity light sensor 180G can also be used for automatic unlocking and locking of the holster mode and pocket mode.
[0174] The ambient light sensor 180L is used to sense the ambient light brightness. The electronic device 100 can adaptively adjust the brightness of the display screen 194 according to the sensed ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the electronic device 100 is in the pocket to prevent accidental touch.
[0175] The fingerprint sensor 180H is used to collect fingerprints. The electronic device 100 can use the collected fingerprint characteristics to achieve fingerprint unlocking, access application locks, fingerprint photography, fingerprint answering calls, etc.
[0176] The temperature sensor 180J is used to detect temperature. In some embodiments, the electronic device 100 uses the temperature detected by the temperature sensor 180J to execute a temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold, the electronic device 100 reduces the performance of the processor near the temperature sensor 180J to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the electronic device 100 heats the battery 142 to avoid abnormal shutdown of the electronic device 100 caused by low temperature. In some other embodiments, when the temperature is lower than yet another threshold, the electronic device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
[0177] The touch sensor 180K, also known as the "touch control device". The touch sensor 180K can be disposed on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also known as the "touch control screen". The touch sensor 180K is used to detect touch operations acting thereon or nearby. The touch sensor can transmit the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In some other embodiments, the touch sensor 180K can also be disposed on the surface of the electronic device 100, at a different position from that of the display screen 194.
[0178] The bone conduction sensor 180M can acquire vibration signals. In some embodiments, the bone conduction sensor 180M can acquire vibration signals of the vibrating bone mass of the human vocal part. The bone conduction sensor 180M can also contact the human pulse to receive blood pressure pulsation signals. In some embodiments, the bone conduction sensor 180M can also be disposed in the earphone to form a bone conduction earphone. The audio module 170 can analyze the voice signals based on the vibration signals of the vibrating bone mass of the human vocal part acquired by the bone conduction sensor 180M to implement the voice function. The application processor can analyze the heart rate information based on the blood pressure pulsation signals acquired by the bone conduction sensor 180M to implement the heart rate detection function.
[0179] The button 190 includes a power-on button, a volume button, etc. The button 190 can be a mechanical button or a touch button. The electronic device 100 can receive button inputs to generate key signal inputs related to the user settings and function controls of the electronic device 100.
[0180] The motor 191 can generate vibration prompts. The motor 191 can be used for incoming call vibration prompts and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. Touch operations acting on different regions of the display screen 194 can also correspond to different vibration feedback effects for the motor 191. Different application scenarios (such as time reminder, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0181] The indicator 192 can be an indicator light and can be used to indicate the charging state, power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0182] The SIM card interface 195 is used to connect to a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to achieve contact with and separation from the electronic device 100. The electronic device 100 can support one or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 simultaneously. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, i.e., an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0183] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a microkernel architecture, a microservices architecture, or a cloud architecture. In the embodiments of the present invention, the Android system with a layered architecture is taken as an example to exemplarily illustrate the software structure of the electronic device 100. It should be noted that in the embodiments of the present application, the operating system of the electronic device can include, but is not limited to (Symbian), (Andriod), (iOS), (Blackberry), HarmonyOS, etc. operating systems, and the present application makes no limitation. Figure 11 The software structure block diagram of the electronic device 100 provided in the embodiments of the present application is shown.
[0184] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom, namely the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.
[0185] The application layer can include a series of application packages.
[0186] As Figure 11 shown, the application packages can include applications such as a camera, a gallery, a calendar, a call, a map, a navigation, a WLAN, a Bluetooth, music, a video, a short message, etc.
[0187] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.
[0188] As Figure 11 shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, etc.
[0189] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0190] The content provider is used to store and obtain data, and enable this data to be accessible by applications. The data may include videos, images, audio, dialed and received calls, browsing history and bookmarks, phone books, etc.
[0191] The view system includes visual controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface can be composed of one or more views. For example, a display interface including a text message notification icon may include a view for displaying text and a view for displaying pictures.
[0192] The phone manager is used to provide the communication function of the electronic device 100. For example, the management of call states (including answering, hanging up, etc.).
[0193] The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc.
[0194] The notification manager enables applications to display notification information in the status bar, can be used to convey notification-type messages, can automatically disappear after a short stay without user interaction. For example, the notification manager is used to inform that the download is completed, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or a scroll bar text, such as the notification of a background-running application, and can also be a notification that appears on the screen in the form of a dialogue window. For example, prompting text information in the status bar, emitting a prompt tone, vibrating the electronic device, flashing the indicator light, etc.
[0195] Android Runtime includes a core library and a virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
[0196] The core library contains two parts: one part is the functional functions that need to be called by the Java language, and the other part is the core library of Android.
[0197] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0198] The system library can include multiple functional modules. For example: surface manager, Media Libraries, 3D graphics processing library (e.g., OpenGL ES), 2D graphics engine (e.g., SGL), etc.
[0199] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
[0200] The media library supports the playback and recording of multiple common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0201] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.
[0202] The 2D graphics engine is a drawing engine for 2D drawing.
[0203] The kernel layer is the layer between the hardware and the software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0204] Next, in combination with the capture and photographing scenario, the working processes of the software and hardware of the electronic device 100 will be exemplarily described.
[0205] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including information such as touch coordinates and the timestamp of the touch operation). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the input event. Taking the touch operation as a touch click operation and the control corresponding to the click operation as the control of the camera application icon as an example, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer, and captures a static image or video through the camera 193.
[0206] Figure 12 Shows a schematic structural diagram of a router provided by an embodiment of the present application. As Figure 12As shown, the router 200 may include: a processor 210, a wireless communication module 220, a memory 230, a power module 240, a communication interface 250, a switch 260, and an antenna.
[0207] The processor 210 may include one or more processing units. For example, the processor 210 may include a CPU, a GPU, a DSP, an ISP, an AP, an NPU, a modem processor, a controller, a video codec, a baseband processor, etc. In some embodiments, different processing units may be independent devices or integrated in one or more processors. Among them, the CPU is the final execution unit for information processing and program running, and its main tasks include processing instructions, executing operations, controlling time, and processing data, etc. The CPU may include a controller, an arithmetic unit, a cache memory, and a bus for connecting these components.
[0208] The wireless communication module 220 may provide wireless communications such as Wi-Fi, frequency modulation (FM), Bluetooth, or NFC, etc. The wireless communication module 220 may be one or more devices integrating at least one communication processing module. The wireless communication module 220 receives electromagnetic waves via the antenna, performs frequency modulation and filtering processing on the electromagnetic wave signals, and sends the processed signals to the processor 210. The wireless communication module 220 may also receive the signals to be sent from the processor 210, perform frequency modulation and amplification on them, and convert them into electromagnetic waves through the antenna for radiation.
[0209] The memory 230 may be used to store computer-executable program codes, and the executable program codes include computer instructions. The processor 210 executes various functions and data processing by running the instructions stored in the memory 230. The memory 230 may include a program storage area and a data storage area. Among them, the program storage area may store application programs required for at least one function (such as statistics of Internet access duration, sending packets, etc.). The data storage area may store information related to connections, etc. In addition, the memory 230 may include a high-speed random access memory and may also include a non-volatile memory, etc.
[0210] The power module 240 may be used to receive power input, store electrical energy, and supply power to the processor 210, the wireless communication module 220, the memory 230, etc.
[0211] The communication interface 250 may be used to communicate with external devices such as electronic devices, external hard drives, and USB flash drives. The communication interface 250 may be any possible interface such as a network port or a universal serial bus (USB) interface.
[0212] The switch 260 is used to trigger the startup or shutdown of the router.
[0213] The device (router) provided in this embodiment is used to execute the above method, so the same effects as those of the above implementation method can be achieved. In the case of adopting an integrated unit, the device may include a processing module, a storage module, and a communication module. Among them, the processing module can be used to control and manage the operations of the device. For example, it can be used to support the device in executing the steps performed by the processing unit. The storage module can be used to support the device in executing stored program codes and data, etc. The communication module can be used to support the communication between the device and other devices.
[0214] This application embodiment also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps in the above various method embodiments can be implemented.
[0215] This application embodiment provides a computer program product. When the computer program product runs on a device, the device is enabled to execute the steps in the above various method embodiments.
[0216] In addition, an embodiment of this application also provides a device, which may specifically be a chip, a component, or a module. The device may include a processor and a memory connected to each other. Among them, the memory is used to store computer-executable instructions. When the device runs, the processor can execute the computer-executable instructions stored in the memory, so that the chip executes the methods in the above various method embodiments.
[0217] In the embodiments provided in this application, it should be understood that the disclosed device / equipment and method can be implemented in other ways. For example, the device / equipment embodiments described above are merely illustrative. For example, the division of the above modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical, or other form.
[0218] In addition, in each embodiment of this application, the various functional units can be integrated in one processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
[0219] When the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, to implement all or part of the processes in the above-described embodiment methods of this application, a computer program can be used to instruct relevant hardware to complete the task. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above-described method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can at least include: any entity or device that can carry the computer program code to the photographing device / terminal device, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signal, telecommunication signal, and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk, or an optical disc, etc. In some jurisdictions, according to legislation and patent practice, the computer-readable medium cannot be an electrical carrier signal and a telecommunication signal.
[0220] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0221] In the above description, specific details such as specific system structures and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the embodiments of this application. However, those skilled in the art should understand that this application can also be implemented in other embodiments without these specific details. In other cases, the detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of this application.
[0222] It should be understood that when used in the specification of this application and the appended claims, the term "comprising" indicates the presence of the described features, wholes, steps, operations, elements, and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components, and / or their combinations.
[0223] It should also be understood that the "plurality" mentioned in the specification of this application and the appended claims means two or more. In the description of this application, unless otherwise specified, " / " means "or". For example, A / B can mean A or B; the "and / or" herein is merely a description of the association relationship of associated objects, which means any combination and all possible combinations of one or more of the associated listed items, and includes these combinations. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone, these three situations.
[0224] As used in the specification of this application and the appended claims, the term "if" can be interpreted as "when...", "once", "in response to determining", or "in response to detecting" according to the context. Similarly, the phrase "if determined" or "if [the described condition or event] is detected" can be interpreted as meaning "once determined", "in response to determining", "once [the described condition or event] is detected", or "in response to detecting [the described condition or event]" according to the context.
[0225] In addition, the reference to "one embodiment" or "some embodiments" etc. described in the specification of this application means that a specific feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of this application. Thus, the statements "in one embodiment", "in some embodiments", "in other some embodiments", "in still other embodiments", etc. that appear in different places in this specification do not necessarily all refer to the same embodiment, but mean "one or more but not all of the embodiments", unless otherwise specifically emphasized in other ways. The terms "comprise", "include", "have" and their variants all mean "include but not limited to", unless otherwise specifically emphasized in other ways.
[0226] The above-described embodiments are only used to illustrate the technical solutions of this application, rather than to limit them; although this application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for counting the Internet access duration, characterized in that, communication is supported between a first device and a second device, at least one application is installed on the first device, and the method is applied to the second device. The method includes: After detecting that a first application establishes a connection with a corresponding server, obtaining connection-related information at a preset period. The first application and the corresponding server transmit data through the second device. The first application is any application among the at least one application that establishes a connection with the corresponding server. The connection-related information includes a maximum allowable survival duration and a connection status; Monitoring the status of the connection within each preset period; When the status of the connection is in use, monitoring the duration that the connection lasts within each preset period; Determining the Internet access duration of the first application according to the duration that the connection lasts within each preset period; The monitoring of the duration that the connection lasts within each preset period includes: obtaining a first duration and a second duration. The first duration is the maximum allowable survival duration of the connection, and the second duration is the remaining survival duration of the connection corresponding to the end moment of each preset period; Determining the difference between the first duration and the second duration; In the case where the difference is less than the preset period, determining the difference as the duration that the connection lasts within the corresponding preset period; or, In the case where the difference is greater than or equal to the preset period, determining the duration of the preset period as the duration that the connection lasts within the corresponding preset period.
2. The method according to claim 1, characterized in that, the method further includes: Determining the Internet access duration corresponding to applications of the same type among the at least one application and / or the Internet access duration corresponding to the first device according to the Internet access duration of the first application.
3. The method according to claim 2, characterized in that, After detecting that a first application establishes a connection with a corresponding server, the method further includes: Obtaining at least one of an application identifier corresponding to the connection, an identifier of an application type, and a device identifier; Determining the Internet access duration of the first application according to the duration from the start to the disconnection of the connection, including: Determining the Internet access duration of the first application according to the application identifier corresponding to the connection and the duration from the start to the disconnection of the connection; The determining of the Internet access duration corresponding to applications of the same type among the at least one application and / or the Internet access duration corresponding to the first device includes: Determining the Internet access duration corresponding to applications of the same type among the at least one application and / or the Internet access duration corresponding to the first device according to the Internet access duration of the first application, the identifier of the application type corresponding to the connection, and / or the device identifier.
4. The method according to any one of claims 1 to 3, characterized in that, the determining of the Internet access duration of the first application according to the duration that the connection lasts within each preset period includes: Determine the Internet access duration of the first application within the same preset period according to the durations of each connection corresponding to the first application that last within the same preset period; Add up the Internet access durations of the first application within each preset period to obtain the Internet access duration of the first application.
5. The method according to claim 4, wherein, the determination of the Internet access duration of the first application within the same preset period includes: Determine the maximum duration among the durations of each connection corresponding to the first application that last within the same preset period as the Internet access duration of the first application within the same preset period.
6. The method according to claim 1, wherein, the monitoring of the duration of each connection that lasts within each preset period includes: Obtain the flag bit corresponding to the current preset period of the connection; When the flag bit is the first flag bit, determine the duration of the connection within the current preset period according to the difference between the first duration and the second duration, where the first duration is the maximum allowable survival duration of the connection, and the second duration is the remaining survival duration of the connection corresponding to the end moment of the current preset period; or, When the flag bit is the second flag bit, determine the duration of the preset period as the duration of the connection within the current preset period.
7. An electronic device, wherein, comprising: One or more processors; one or more memories; The memory stores one or more programs, and when the one or more programs are executed by the processor, the electronic device executes the method according to any one of claims 1 to 6.
8. A computer-readable storage medium, wherein, The computer-readable storage medium stores instructions, and when they run on a computer, the computer executes the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Control method, management and control platform, gateway equipment and computer storage medium
CN111262817A
Data processing method and device, network equipment and medium
CN114356593A
Method and device for measuring the duration of internet access
WO2018137887A1