CN107484201B - Traffic statistics method and device, terminal, and computer-readable storage medium - Google Patents
Traffic statistics method and device, terminal, and computer-readable storage medium Download PDFInfo
- Publication number
- CN107484201B CN107484201B CN201710924584.5A CN201710924584A CN107484201B CN 107484201 B CN107484201 B CN 107484201B CN 201710924584 A CN201710924584 A CN 201710924584A CN 107484201 B CN107484201 B CN 107484201B
- Authority
- CN
- China
- Prior art keywords
- traffic
- information
- terminal
- statistical information
- file system
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 238000007619 statistical method Methods 0.000 claims abstract 2
- 238000012545 processing Methods 0.000 claims description 21
- 238000004590 computer program Methods 0.000 claims description 16
- 239000010410 layer Substances 0.000 claims 4
- 239000012792 core layer Substances 0.000 claims 2
- 230000006870 function Effects 0.000 description 13
- 238000004891 communication Methods 0.000 description 12
- 238000010586 diagram Methods 0.000 description 11
- 238000007726 management method Methods 0.000 description 10
- 230000006978 adaptation Effects 0.000 description 5
- 230000001133 acceleration Effects 0.000 description 3
- 230000005540 biological transmission Effects 0.000 description 3
- 238000001514 detection method Methods 0.000 description 3
- 230000007774 longterm Effects 0.000 description 3
- 238000013500 data storage Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000002093 peripheral effect Effects 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 230000003213 activating effect Effects 0.000 description 1
- 230000004913 activation Effects 0.000 description 1
- 238000012217 deletion Methods 0.000 description 1
- 230000037430 deletion Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000007599 discharging Methods 0.000 description 1
- 230000005484 gravity Effects 0.000 description 1
- 238000012905 input function Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 230000008520 organization Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 238000010079 rubber tapping Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 230000005236 sound signal Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000010897 surface acoustic wave method Methods 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W24/00—Supervisory, monitoring or testing arrangements
- H04W24/08—Testing, supervising or monitoring using real traffic
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0876—Network utilisation, e.g. volume of load or congestion level
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04M—TELEPHONIC COMMUNICATION
- H04M1/00—Substation equipment, e.g. for use by subscribers
- H04M1/72—Mobile telephones; Cordless telephones, i.e. devices for establishing wireless links to base stations without route selection
- H04M1/724—User interfaces specially adapted for cordless or mobile telephones
- H04M1/72403—User interfaces specially adapted for cordless or mobile telephones with means for local support of applications that increase the functionality
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Human Computer Interaction (AREA)
- Telephonic Communication Services (AREA)
- Mobile Radio Communication Systems (AREA)
Abstract
Description
技术领域technical field
本申请涉及通信技术领域,特别是涉及一种流量统计方法和装置、终端、计算机可读存储介质。The present application relates to the field of communication technologies, and in particular, to a traffic statistics method and device, a terminal, and a computer-readable storage medium.
背景技术Background technique
流量是指网络服务提供者提供给用户终端在一段时间内使用来访问网络的数据量。为了帮助用户了解用户终端使用流量的情况,有些应用服务提供者开发出应用程序,通过应用程序可以查询一段时间内流量使用情况。用户终端的内核层会统计流量的使用情况,每次统计时,需要对内核层进行更新流量统计数据,耗费大量资源。Traffic refers to the amount of data that the network service provider provides to the user terminal to access the network within a period of time. In order to help users understand the traffic usage of user terminals, some application service providers have developed applications, through which the traffic usage over a period of time can be queried. The kernel layer of the user terminal will collect statistics on the traffic usage. Every time the statistics are collected, the kernel layer needs to update the traffic statistics, which consumes a lot of resources.
发明内容SUMMARY OF THE INVENTION
本申请实施例提供一种流量统计方法和装置、计算机设备、计算机可读存储介质,可以减少系统资源消耗。Embodiments of the present application provide a traffic statistics method and apparatus, computer equipment, and a computer-readable storage medium, which can reduce system resource consumption.
一种流量统计方法,应用于终端,包括:A traffic statistics method, applied to a terminal, includes:
接收流量统计请求;Receive traffic statistics requests;
根据所述流量统计请求获取所述终端内的文件系统中记录的第一流量统计信息,以及获取所述终端内的缓存中记录的第二流量统计信息,所述第一流量统计信息表示写入到所述文件系统中的数据的流量统计信息,所述第二流量统计信息表示所述缓存中存储且未写入到所述文件系统中的数据的流量统计信息;及Acquire the first traffic statistics information recorded in the file system in the terminal according to the traffic statistics request, and acquire the second traffic statistics information recorded in the cache in the terminal, where the first traffic statistics information indicates writing traffic statistics to data in the file system, the second traffic statistics representing traffic statistics for data stored in the cache and not written to the file system; and
根据所述第一流量统计信息和所述第二流量统计信息得到所述终端所使用的总流量统计信息。The total traffic statistics information used by the terminal is obtained according to the first traffic statistics information and the second traffic statistics information.
一种流量统计装置,应用于终端,包括:A traffic statistics device, applied to a terminal, includes:
请求接收模块,用于接收流量统计请求;The request receiving module is used to receive traffic statistics requests;
流量获取模块,用于根据所述流量统计请求获取所述终端内的文件系统中记录的第一流量统计信息,以及获取所述终端内的缓存中记录的第二流量统计信息,所述第一流量统计信息表示写入到所述文件系统中的数据的流量统计信息,所述第二流量统计信息表示所述缓存中存储且未写入到所述文件系统中的数据的流量统计信息;及A traffic acquisition module, configured to acquire the first traffic statistics information recorded in the file system in the terminal according to the traffic statistics request, and acquire the second traffic statistics information recorded in the cache in the terminal, the first traffic statistics The traffic statistics information represents traffic statistics information of data written to the file system, the second traffic statistics information represents traffic statistics information of data stored in the cache and not written to the file system; and
处理模块,用于根据所述第一流量统计信息和所述第二流量统计信息得到所述终端所使用的总流量统计信息。A processing module, configured to obtain the total traffic statistics information used by the terminal according to the first traffic statistics information and the second traffic statistics information.
一种终端,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行时实现所述流量统计方法的步骤。A terminal includes a memory and a processor, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor implements the steps of the traffic statistics method when executed.
一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现所述流量统计方法的步骤。A computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of the traffic statistics method.
本申请实施例提供的流量统计方法和装置、终端、计算机可读存储介质,根据流量统计请求,获取文件系统中记录的第一流量统计信息,以及获取缓存中的第二流量统计信息,结合第一流量统计信息和第二流量统计信息可得到终端所使用的总流量统计信息,不需要每次根据流量统计请求对系统内核进行写操作,减少了对系统内核的资源消耗。The traffic statistics method and device, the terminal, and the computer-readable storage medium provided by the embodiments of the present application, according to the traffic statistics request, acquire the first traffic statistics information recorded in the file system, and acquire the second traffic statistics information in the cache, in combination with the first traffic statistics information recorded in the file system. The first traffic statistics information and the second traffic statistics information can obtain the total traffic statistics information used by the terminal, and there is no need to write the system kernel every time according to the traffic statistics request, which reduces the resource consumption of the system kernel.
附图说明Description of drawings
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings without any creative effort.
图1为一个实施例中流量统计方法的应用环境示意图;1 is a schematic diagram of an application environment of a traffic statistics method in one embodiment;
图2为一个实施例中流量统计方法的流程图;Fig. 2 is the flow chart of the traffic statistics method in one embodiment;
图3为一个实施例中获取缓存中记录的第二流量统计信息的流程图;3 is a flow chart of obtaining the second traffic statistics information recorded in the cache in one embodiment;
图4为另一个实施例中流量统计方法的流程图;4 is a flowchart of a traffic statistics method in another embodiment;
图5为一个实施例中流量统计装置的结构框图;5 is a structural block diagram of a flow statistics apparatus in one embodiment;
图6A为另一个实施例中流量统计装置的结构框图;6A is a structural block diagram of a flow statistics apparatus in another embodiment;
图6B为另一个实施例中流量统计装置的结构框图;6B is a structural block diagram of a flow statistics apparatus in another embodiment;
图7为一个实施例中终端内部结构框图;7 is a block diagram of the internal structure of the terminal in one embodiment;
图8为一个实施例中终端使用虚拟SIM卡的应用环境;8 is an application environment in which a terminal uses a virtual SIM card in one embodiment;
图9为一个实施例中终端的部分架构示意图;9 is a schematic diagram of a partial architecture of a terminal in one embodiment;
图10为一个实施例中与终端相关的手机的部分结构的框图。FIG. 10 is a block diagram of a partial structure of a mobile phone associated with a terminal in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.
图1为一个实施例中流量统计方法的应用环境示意图。如图1所示,该应用环境包括终端110。在终端110上安装有查询流量的应用程序,用户通过该应用程序可以查询得到当前流量的使用总量。终端110接收到应用程序发起的流量统计请求后,获取文件系统中记录的第一流量统计信息,以及缓存中记录的第二流量统计信息,根据第一流量统计信息和第二流量统计信息求和得到当前总流量统计信息。可以直接读取文件系统及获取缓存中的流量统计信息,得到当前总流量统计信息,不需要每次接收流量统计请求,均将缓存中的流量统计信息写入到文件系统中进行统计,减小了系统的资源消耗。FIG. 1 is a schematic diagram of an application environment of a traffic statistics method in an embodiment. As shown in FIG. 1 , the application environment includes a
如图2所示,在一个实施例中,提供了一种流量统计方法。本实施例以所述流量统计方法主要应用在图1中的终端上来举例说明。参照图2,所述流量统计方法,包括步骤202至步骤206。As shown in FIG. 2, in one embodiment, a traffic statistics method is provided. This embodiment is illustrated by taking that the traffic statistics method is mainly applied to the terminal in FIG. 1 as an example. Referring to FIG. 2 , the traffic statistics method includes
步骤202,接收流量统计请求。
其中,终端上安装有应用程序,可通过应用程序查询流量统计情况。终端接收到用户对应用程序触发产生的流量统计请求。终端可检测到用户通过按键、触摸屏等触发应用程序上的查询按钮,发出流量统计请求;或者终端检测到用户的手势操作,识别该手势操作为流量统计指令,发出流量统计请求;或者中点接收到语音信号,识别该语音信号为流量统计指令,发出流量统计请求。Among them, an application program is installed on the terminal, and traffic statistics can be inquired through the application program. The terminal receives a traffic statistics request triggered by the user to the application. The terminal can detect that the user triggers the query button on the application program through buttons, touch screen, etc., and sends out a traffic statistics request; or the terminal detects the user's gesture operation, recognizes the gesture operation as a traffic statistics command, and sends out a traffic statistics request; or midpoint reception To the voice signal, identify the voice signal as a traffic statistics command, and issue a traffic statistics request.
步骤204,根据所述流量统计请求获取终端内的文件系统中记录的第一流量统计信息,以及获取所述终端内的缓存中记录的第二流量统计信息,所述第一流量统计信息表示写入到文件系统中的数据的流量统计信息,所述第二流量统计信息表示所述缓存中存储且未写入到所述文件系统中的数据的流量统计信息。Step 204: Acquire the first traffic statistics information recorded in the file system in the terminal according to the traffic statistics request, and acquire the second traffic statistics information recorded in the cache in the terminal, where the first traffic statistics information indicates writing The traffic statistics information of the data entered into the file system, the second traffic statistics information represents the traffic statistics information of the data stored in the cache and not written into the file system.
其中,文件系统是指终端的内核中用于长期存储流量统计信息的存储空间。文件系统中记录有写入的流量统计信息。缓存是指用于临时存储流量统计信息的存储空间。缓存中存储有预设时长的流量统计信息。缓存中记录的流量统计信息会按照预定时间间隔写入到文件系统中。例如,可每间隔半小时,将缓存中记录的流量统计信息写入到文件系统中,也就是说,缓存中记录有半小时内收集的流量统计信息。例如,10点10分将缓存中记录的流量统计信息写入到文件系统后,10点10分开始到10点40分收集的流量统计信息会先存储在缓存中,在10点40分时,将缓存中记录的流量统计信息写入到文件系统中。可以理解的是,预定时间间隔可根据需要设定,如10分钟、20分钟等。The file system refers to a storage space in the kernel of the terminal for long-term storage of traffic statistics. Write traffic statistics are recorded in the file system. Cache refers to the storage space used to temporarily store traffic statistics. Traffic statistics for a preset duration are stored in the cache. Traffic statistics recorded in the cache are written to the file system at predetermined intervals. For example, the traffic statistics recorded in the cache can be written to the file system every half hour, that is, the traffic statistics collected within half an hour are recorded in the cache. For example, after the traffic statistics recorded in the cache are written to the file system at 10:10, the traffic statistics collected from 10:10 to 10:40 will be stored in the cache first, and at 10:40, the Writes the traffic statistics recorded in the cache to the file system. It can be understood that the predetermined time interval can be set as required, such as 10 minutes, 20 minutes, and the like.
第一流量统计信息表示写入到文件系统中的总流量统计信息。例如,10点10分写入到文件系统的流量统计信息,则第一流量统计信息表示截止到10点10分时写入到文件系统中的总流量统计信息。The first traffic statistics information represents the total traffic statistics information written into the file system. For example, the traffic statistics information written to the file system at 10:10, the first traffic statistics information represents the total traffic statistics written into the file system as of 10:10.
第二流量统计信息表示缓存中存储且未写入到所述文件系统中的数据的流量统计信息。第二流量统计信息也可以表示缓存中记录的第一时刻到当前时刻之间的流量统计信息。第一时刻是指距当前时刻最近一次将缓存中流量统计信息写入到文件系统的时刻。The second traffic statistics information represents the traffic statistics information of the data stored in the cache and not written into the file system. The second traffic statistics information may also represent the traffic statistics information recorded in the cache between the first moment and the current moment. The first moment refers to the latest time from the current moment when the traffic statistics in the cache are written to the file system.
步骤206,根据所述第一流量统计信息和第二流量统计信息得到终端所使用的总流量统计信息。Step 206: Obtain the total traffic statistics information used by the terminal according to the first traffic statistics information and the second traffic statistics information.
具体地,将第一流量统计信息和第二流量统计信息求和得到终端所使用的总流量统计信息,然后输出终端所使用的总流量统计信息。终端所使用的总流量统计信息是指截止到接收到流量统计请求的当前时刻的总流量统计信息。Specifically, summing the first traffic statistics information and the second traffic statistics information to obtain the total traffic statistics information used by the terminal, and then outputting the total traffic statistics information used by the terminal. The total traffic statistics information used by the terminal refers to the total traffic statistics information up to the current moment when the traffic statistics request is received.
上述流量统计方法,根据流量统计请求,获取文件系统中记录的第一流量统计信息,以及获取缓存中的第二流量统计信息,结合第一流量统计信息和第二流量统计信息可得到终端所使用的总流量统计信息,不需要每次根据流量统计请求对系统内核进行写操作,减少了对系统内核的资源消耗。In the above traffic statistics method, the first traffic statistics information recorded in the file system is obtained according to the traffic statistics request, and the second traffic statistics information in the cache is acquired, and the first traffic statistics information and the second traffic statistics information can be combined to obtain the information used by the terminal. The total traffic statistics information of the system does not need to be written to the system kernel every time according to the traffic statistics request, which reduces the resource consumption of the system kernel.
如图3所示,在一个实施例中,所述获取缓存中记录的第二流量统计信息的步骤包括:As shown in FIG. 3, in one embodiment, the step of acquiring the second traffic statistics recorded in the cache includes:
步骤302,获取终端从开机时刻到当前时刻的第三流量统计信息。Step 302: Obtain third traffic statistics information of the terminal from the time of power-on to the current time.
具体地,开机时刻是指终端重启后开机的时刻。当前时刻是指接收流量统计请求的时刻。终端从开机时刻到当前时刻的第三流量统计信息,可包括写入到文件系统中的流量统计信息和未写入到文件系统中的流量统计信息。Specifically, the power-on time refers to the time when the terminal is powered on after restarting. The current moment refers to the moment when the traffic statistics request is received. The third traffic statistics information of the terminal from the power-on time to the current time may include the traffic statistics information written into the file system and the traffic statistics information not written into the file system.
步骤304,从所述文件系统中获取记录的终端从开机时刻到当前时刻的第四流量统计信息。Step 304: Acquire the recorded fourth traffic statistics information of the terminal from the boot time to the current time from the file system.
具体地,文件系统中记录的是终端从开机时刻到当前时刻之间产生的流量统计信息中已写入到文件系统中的流量统计信息。Specifically, what is recorded in the file system is the traffic statistics information that has been written into the file system from the traffic statistics information generated between the time when the terminal is powered on and the current time.
步骤306,根据所述第三流量统计信息与所述第四流量统计信息得到所述第二流量统计信息。Step 306: Obtain the second traffic statistics information according to the third traffic statistics information and the fourth traffic statistics information.
具体地,将第三流量统计信息中排除第四流量统计信息,则可以得到第二流量统计信息,即存储在缓存中的流量统计信息。本实施例中,通过读取文件系统中记录的开机时刻到当前时刻的流量统计信息,以及从开机时刻到当前时刻的总流量统计信息,从而得到缓存中存储的流量统计信息,不需要每次接收到流量统计请求时,将缓存中的流量统计信息写入到文件系统中,减少了对系统内核的写操作,减少了系统资源耗费。Specifically, by excluding the fourth traffic statistics information from the third traffic statistics information, the second traffic statistics information, that is, the traffic statistics information stored in the cache can be obtained. In this embodiment, the traffic statistics information stored in the cache is obtained by reading the traffic statistics information from the boot time to the current time recorded in the file system, and the total traffic statistics information from the boot time to the current time, so as to obtain the traffic statistics information stored in the cache. When a traffic statistics request is received, the traffic statistics information in the cache is written into the file system, which reduces the write operation to the system kernel and reduces the consumption of system resources.
在一个实施例中,所述获取终端从开机时刻到当前时刻的第三流量统计信息,包括:通过第一流量统计接口获取终端从开机时刻到当前时刻的第三流量统计信息,所述第一流量统计接口用于统计终端从开机时刻到当前时刻的流量信息。In one embodiment, the acquiring third traffic statistics information of the terminal from the time of power-on to the current time includes: acquiring the third traffic statistics of the terminal from the time of power-on to the current time through a first traffic statistics interface, the first traffic statistics The traffic statistics interface is used to collect statistics on the traffic information of the terminal from the time it is powered on to the current time.
第一流量统计接口可采用getincrementForNetwork(NetworkTemplatetemplate)接口。getincrementForNetwork接口查询系统/proc/net/xt qtaguid/iface_stat_fmt接口获取从开机时刻到当前时刻的流量快照xtSnapshot。The first traffic statistics interface may use the getincrementForNetwork (NetworkTemplatetemplate) interface. The getincrementForNetwork interface queries the system /proc/net/xt qtaguid/iface_stat_fmt interface to obtain the traffic snapshot xtSnapshot from the boot time to the current time.
在一个实施例中,所述从所述文件系统中获取记录的终端从开机时刻到当前时刻的第四流量统计信息,包括:通过第二流量统计接口从所述文件系统中读取记录的终端从开机时刻到当前时刻的第四流量统计信息,所述第二流量统计接口用于提取已写入到文件系统中的流量信息。In one embodiment, the obtaining the recorded fourth traffic statistics information of the terminal from the file system from the boot time to the current time includes: reading the recorded terminal from the file system through a second traffic statistics interface The fourth traffic statistics information from the power-on time to the current time, the second traffic statistics interface is used to extract the traffic information that has been written into the file system.
第二流量统计接口可采用TrafficMonitor通过performPollLocked()接口获取文件系统中记录的当前流量快照mNetworkStats。The second traffic statistics interface can use TrafficMonitor to obtain the current traffic snapshot mNetworkStats recorded in the file system through the performPollLocked() interface.
在一个实施例中,所述流量统计方法还可包括:按照预定时间间隔将所述缓存中记录的第二流量统计信息写入到所述文件系统中。In one embodiment, the traffic statistics method may further include: writing the second traffic statistics information recorded in the cache into the file system at predetermined time intervals.
预定时间间隔可根据需要设定,如10分钟、20分钟、30分钟等。通过按照预定时间间隔将缓存中记录的第二流量统计信息写入到文件系统中,可以避免频繁对系统内核进行写操作,消耗系统资源。The predetermined time interval can be set as required, such as 10 minutes, 20 minutes, 30 minutes and so on. By writing the second traffic statistics information recorded in the cache into the file system at predetermined time intervals, frequent write operations to the system kernel and consumption of system resources can be avoided.
在一个实施例中,所述流量统计方法还可包括:将所述文件系统中的第一流量统计信息按照网络类型进行划分,得到与所述网络类型对应的流量统计信息;将所述缓存中的第二流量统计信息按照网络类型进行划分,得到与所述网络类型对应的第二子流量统计信息。In one embodiment, the traffic statistics method may further include: dividing the first traffic statistics information in the file system according to network types to obtain traffic statistics information corresponding to the network types; The second traffic statistics information of the device is divided according to the network type, and the second sub-traffic statistics information corresponding to the network type is obtained.
所述根据所述第一流量统计信息和第二流量统计信息得到所述终端所使用的总流量统计信息,包括:将所述网络类型对应的第一子流量统计信息和第二子流量统计信息进行求和得到与所述网络类型对应的总流量统计信息。The obtaining the total traffic statistics information used by the terminal according to the first traffic statistics information and the second traffic statistics information includes: converting the first sub-traffic statistics information and the second sub-traffic statistics information corresponding to the network type The summation is performed to obtain total traffic statistics corresponding to the network type.
具体地,文件系统中存储的第一流量统计信息,可以按照网络类型进行划分,如2G网络流量、3G网络流量、4G网络流量、5G网络流量、漫游网络流量等。按照网络类型划分流量统计信息可以提供更加全面的流量使用情况。Specifically, the first traffic statistics stored in the file system may be classified according to network types, such as 2G network traffic, 3G network traffic, 4G network traffic, 5G network traffic, roaming network traffic, and the like. Breaking down traffic statistics by network type provides a more comprehensive picture of traffic usage.
在一个实施例中,所述流量统计方法还可包括:将所述缓存中的第二流量统计信息按照网络类型进行划分,得到与所述网络类型对应的流量统计信息;将与所述网络类型对应的流量统计信息按照预定时间间隔写入到所述文件系统中。In one embodiment, the traffic statistics method may further include: dividing the second traffic statistics information in the cache according to network types to obtain traffic statistics information corresponding to the network types; Corresponding traffic statistics information is written into the file system at predetermined time intervals.
具体地,缓存中统计的第二流量统计信息按照网络类型进行划分后,写入到文件系统时,可以快速的添加到对应的网络类型的流量统计信息中,提高分类的效率。Specifically, after the second traffic statistics information collected in the cache is divided according to network types, when written to the file system, it can be quickly added to the traffic statistics information of the corresponding network type to improve the efficiency of classification.
如图4所示,在一个实施例中,提供了一种流量统计方法。本实施例中,以该流量统计方法应用于终端上,以Android系统为例,通过应用程序发起流量统计请求来举例说明。参照图4,所述流量统计方法包括:As shown in FIG. 4, in one embodiment, a traffic statistics method is provided. In this embodiment, the traffic statistics method is applied to a terminal, taking an Android system as an example, and an application program initiates a traffic statistics request for illustration. Referring to Figure 4, the traffic statistics method includes:
步骤402,接收应用程序发起的流量统计请求。Step 402: Receive a traffic statistics request initiated by an application.
具体地,终端的应用框架层接收到应用程序发起的流量统计请求,根据流量统计请求获取对应的流量统计信息。Specifically, the application framework layer of the terminal receives the traffic statistics request initiated by the application, and obtains corresponding traffic statistics information according to the traffic statistics request.
步骤404,根据所述流量统计请求通过应用框架层的第一流量统计接口读取内核层的文件系统中记录的第一流量统计信息,所述第一流量统计信息包括终端重启前的流量统计信息和开机后的流量统计信息,以及通过第二流量统计接口获取终端从开机时刻到当前时刻的第三流量统计信息;所述第一流量统计接口用于统计终端从开机时刻到当前时刻的流量统计信息;所述第二流量统计接口用于提取已写入到文件系统中的流量统计信息。Step 404: Read the first traffic statistics information recorded in the file system of the kernel layer through the first traffic statistics interface of the application framework layer according to the traffic statistics request, where the first traffic statistics information includes the traffic statistics information before the terminal restarts and the traffic statistics information after booting, and obtain the third traffic statistics information of the terminal from the boot time to the current moment through the second traffic statistics interface; the first traffic statistics interface is used to count the traffic statistics of the terminal from the boot time to the current moment information; the second traffic statistics interface is used to extract the traffic statistics information written into the file system.
应用框架层是指Android系统中编写Google发布的核心应用时所使用的应用程序接口框架,开发人员可以使用这些框架来开发应用,简化了程序开发的架构设计。开机后的流量统计信息是指开机时刻到当前时刻的流量统计信息,即为第四流量统计信息。The application framework layer refers to the application programming interface framework used in the Android system to write the core applications released by Google. Developers can use these frameworks to develop applications, which simplifies the architecture design of program development. The traffic statistics information after booting refers to the traffic statistics information from the boot time to the current time, which is the fourth traffic statistics information.
步骤406,根据所述开机后的流量统计信息与第三流量统计信息得到所述内核层的缓存中的第二流量统计信息。Step 406: Obtain second traffic statistics information in the cache of the kernel layer according to the traffic statistics information after booting and the third traffic statistics information.
具体地,内核层是指Android系统中提供核心系统服务的层,通常基于Linux内核,内核层中安装有终端的相关驱动程序。Specifically, the kernel layer refers to a layer in the Android system that provides core system services, and is usually based on the Linux kernel, and the relevant driver of the terminal is installed in the kernel layer.
步骤408,根据所述第一流量统计信息和第二流量统计信息计算得到终端所使用的总流量统计信息。Step 408: Calculate and obtain total traffic statistics information used by the terminal according to the first traffic statistics information and the second traffic statistics information.
将第一流量统计信息和第二流量统计信息求和得到终端所使用的总流量统计信息。终端所使用的总流量统计信息是指接收到流量统计请求时刻的总流量统计信息。The total traffic statistics information used by the terminal is obtained by summing the first traffic statistics information and the second traffic statistics information. The total traffic statistics information used by the terminal refers to the total traffic statistics information at the moment when the traffic statistics request is received.
步骤410,在所述应用程序界面输出所述终端所使用的总流量统计信息。Step 410: Output the total traffic statistics information used by the terminal on the application program interface.
在应用程序界面可以文字形式展示终端所使用的总流量统计信息,或者语音播报方式输出终端所使用的总流量统计信息,或者图表形式显示终端所使用的总流量统计信息。In the application program interface, the total traffic statistics information used by the terminal can be displayed in text form, or the total traffic statistics information used by the terminal can be output by voice broadcast, or the total traffic statistics information used by the terminal can be displayed in the form of graphs.
上述流量统计方法,根据流量统计请求,通过第一流量统计接口读取内核层的文件系统中记录的第一流量统计信息中的重启前的流量统计信息和开机后的流量统计信息,以及通过第二流量统计接口获取开机时刻到当前时刻的流量统计信息,得到缓存中的第二流量统计信息,结合第一流量统计信息和第二流量统计信息可得到终端所使用的总流量统计信息,不需要每次根据流量统计请求对系统内核进行写操作,减少了对系统内核的资源消耗。In the above traffic statistics method, according to the traffic statistics request, the first traffic statistics information recorded in the file system of the kernel layer, the traffic statistics information before restart and the traffic statistics information after booting, are read through the first traffic statistics interface. The second traffic statistics interface obtains the traffic statistics information from the power-on time to the current time, and obtains the second traffic statistics information in the cache. Combined with the first traffic statistics information and the second traffic statistics information, the total traffic statistics information used by the terminal can be obtained. Each time the system kernel is written according to the traffic statistics request, the resource consumption of the system kernel is reduced.
在其他实施例中,操作系统不限于Android,还可以是IOS系统,windows phone,BlackBerry等。In other embodiments, the operating system is not limited to Android, but may also be an IOS system, a windows phone, a BlackBerry, or the like.
如图5所示,提供了一种流量统计装置。本实施例中以该流量统计装置应用于图1中的终端来举例说明。参照图5,一种流量统计装置,包括请求接收模块510、流量获取模块520和处理模块530。其中:As shown in Fig. 5, a flow statistics device is provided. In this embodiment, the traffic statistics apparatus is applied to the terminal in FIG. 1 as an example for illustration. Referring to FIG. 5 , a traffic statistics device includes a
请求接收模块510用于接收流量统计请求。The
流量获取模块520用于根据所述流量统计请求获取终端内的文件系统中记录的第一流量统计信息,以及获取终端内的缓存中记录的第二流量统计信息,所述第一流量统计信息表示写入到文件系统中的数据的流量统计信息,所述第二流量统计信息表示所述缓存中存储且未写入到所述文件系统中的数据的流量统计信息。The
处理模块530用于根据所述第一流量统计信息和第二流量统计信息得到所述终端所使用的总流量统计信息。The
上述流量统计装置,根据流量统计请求,获取文件系统中记录的第一流量统计信息,以及获取缓存中的第二流量统计信息,结合第一流量统计信息和第二流量统计信息可得到终端所使用的总流量统计信息,不需要每次根据流量统计请求对系统内核进行写操作,减少了对系统内核的资源消耗。The above-mentioned traffic statistics device, according to the traffic statistics request, acquires the first traffic statistics information recorded in the file system, and acquires the second traffic statistics information in the cache, and the first traffic statistics information and the second traffic statistics information can be used by the terminal to be obtained by combining the first traffic statistics information and the second traffic statistics information The total traffic statistics information of the system does not need to be written to the system kernel every time according to the traffic statistics request, which reduces the resource consumption of the system kernel.
在一个实施例中,可选地,流量获取模块520还用于获取终端从开机时刻到当前时刻的第三流量统计信息;从所述文件系统中获取记录的终端从开机时刻到当前时刻的第四流量统计信息;及根据所述第三流量统计信息与所述第四流量统计信息得到所述第二流量统计信息。In one embodiment, optionally, the
在一个实施例中,可选地,流量获取模块520还用于通过第一流量统计接口获取终端从开机时刻到当前时刻的第三流量统计信息,所述第一流量统计接口用于统计终端从开机时刻到当前时刻的流量信息;通过第二流量统计接口从所述文件系统中读取记录的终端从开机时刻到当前时刻的第四流量统计信息,所述第二流量统计接口用于提取已写入到文件系统中的流量信息。In an embodiment, optionally, the
如图6A所示,在另一个实施例中,提供了另一种流量统计装置。该流量统计装置除了包括请求接收模块510、流量获取模块520和处理模块530,还包括写入模块540和分类模块550。As shown in FIG. 6A, in another embodiment, another traffic statistics apparatus is provided. In addition to the
写入模块540用于按照预定时间间隔将所述缓存中记录的第二流量统计信息写入到所述文件系统中。The
分类模块550用于将所述文件系统中的第一流量统计信息按照网络类型进行划分,得到与所述网络类型对应的流量统计信息,以及将所述缓存中的第二流量统计信息按照网络类型进行划分,得到与所述网络类型对应的第二子流量统计信息。The
处理模块530还用于将所述网络类型对应的第一子流量统计信息和第二子流量统计信息进行求和得到与所述网络类型对应的总流量统计信息。The
可选地,分类模块550还用于将所述缓存中的第二流量统计信息按照网络类型进行划分,得到与所述网络类型对应的流量统计信息;Optionally, the
写入模块540还用于将与所述网络类型对应的流量统计信息按照预定时间间隔写入到所述文件系统中。The
如图6B所示,在另一个实施例中,提供了另一种流量统计装置。该流量统计装置除了包括请求接收模块510、流量获取模块520和处理模块530,还包括输出模块560。As shown in FIG. 6B, in another embodiment, another traffic statistics apparatus is provided. In addition to the
请求接收模块510用于接收应用程序发起的流量统计请求。The
流量获取模块520用于根据所述流量统计请求通过终端的应用框架层的第一流量统计接口读取内核层的文件系统中记录的第一流量统计信息,所述第一流量统计信息包括终端重启前的流量统计信息和开机后的流量统计信息,以及通过第二流量统计接口获取终端从开机时刻到当前时刻的第三流量统计信息;所述第一流量统计接口用于统计终端从开机时刻到当前时刻的流量信息;所述第二流量统计接口用于提取已写入到文件系统中的流量信息;根据所述开机后的流量统计信息与第三流量统计信息得到所述内核层的缓存中的第二流量统计信息。The
处理模块530用于根据所述第一流量统计信息和第二流量统计信息计算得到终端所使用的总流量统计信息。The
输出模块560用于在所述应用程序界面输出所述终端所使用的总流量统计信息。The
上述流量统计装置,根据流量统计请求,通过第一流量统计接口读取内核层的文件系统中记录的第一流量统计信息中的重启前的流量统计信息和开机后的流量统计信息,以及通过第二流量统计接口获取开机时刻到当前时刻的流量统计信息,得到缓存中的第二流量统计信息,结合第一流量统计信息和第二流量统计信息可得到终端所使用的总流量统计信息,不需要每次根据流量统计请求对系统内核进行写操作,减少了对系统内核的资源消耗。The above-mentioned traffic statistics device, according to the traffic statistics request, reads the traffic statistics information before restart and the traffic statistics information after booting in the first traffic statistics information recorded in the file system of the kernel layer through the first traffic statistics interface, and passes the first traffic statistics information. The second traffic statistics interface obtains the traffic statistics information from the power-on time to the current time, and obtains the second traffic statistics information in the cache. Combined with the first traffic statistics information and the second traffic statistics information, the total traffic statistics information used by the terminal can be obtained. Each time the system kernel is written according to the traffic statistics request, the resource consumption of the system kernel is reduced.
上述流量统计装置中各个模块的划分仅用于举例说明,在其他实施例中,可将流量统计装置按照需要划分为不同的模块,以完成上述流量统计装置的全部或部分功能。The division of each module in the above traffic statistics device is only used for illustration. In other embodiments, the traffic statistics device may be divided into different modules as required to complete all or part of the functions of the traffic statistics device.
本申请实施例还提供了一种终端。一种终端,包括存储器及处理器,所述存储器中储存有计算机程序,所述计算机程序被所述处理器执行时,使得所述处理器执行时实现本申请所述流量统计方法,如图2至图4中所述的流量统计方法。如图7所示,该终端包括通过系统总线连接的处理器、存储器。其中,该处理器用于提供计算和控制能力,支撑整个计算机设备的运行。存储器用于存储数据、程序等,存储器上存储至少一个计算机程序,该计算机程序可被处理器执行,以实现本申请实施例中提供的适用于终端的流量统计方法。存储器可包括磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random-Access-Memory,RAM)等。例如,在一个实施例中,存储器包括非易失性存储介质及内存储器。非易失性存储介质存储有操作系统和计算机程序。该计算机程序可被处理器所执行,以用于实现以下各个实施例所提供的流量统计方法。内存储器为非易失性存储介质中的操作系统计算机程序提供高速缓存的运行环境。该计算机设备可以是手机、平板电脑或者个人数字助理或穿戴式设备等。The embodiment of the present application also provides a terminal. A terminal includes a memory and a processor, and a computer program is stored in the memory. When the computer program is executed by the processor, the processor implements the traffic statistics method of the present application when executed, as shown in FIG. 2 to the traffic statistics method described in Figure 4. As shown in FIG. 7 , the terminal includes a processor and a memory connected through a system bus. Among them, the processor is used to provide computing and control capabilities to support the operation of the entire computer equipment. The memory is used for storing data, programs, etc., and at least one computer program is stored in the memory, and the computer program can be executed by the processor to implement the traffic statistics method applicable to the terminal provided in the embodiment of the present application. The memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, and a read-only memory (Read-Only Memory, ROM), or a random-access-memory (Random-Access-Memory, RAM) and the like. For example, in one embodiment, the memory includes a non-volatile storage medium and internal memory. The nonvolatile storage medium stores an operating system and a computer program. The computer program can be executed by the processor to implement the traffic statistics methods provided in the following embodiments. Internal memory provides a cached execution environment for operating system computer programs in non-volatile storage media. The computer device may be a mobile phone, a tablet computer, a personal digital assistant or a wearable device, or the like.
本申请实施例还提供了一种计算机可读存储介质。一个或多个包含计算机可执行指令的非易失性计算机可读存储介质,当所述计算机可执行指令被一个或多个处理器执行时,使得所述处理器执行如上述各实施例中所描述的流量统计方法。Embodiments of the present application also provide a computer-readable storage medium. One or more non-volatile computer-readable storage media containing computer-executable instructions that, when executed by one or more processors, cause the processors to perform as described in the various embodiments above. Describes the traffic statistics method.
本申请实施例还提供了一种计算机程序产品。一种包含指令的计算机程序产品,当其在计算机上运行时,使得计算机执行上述各实施例中所描述的流量统计方法。The embodiments of the present application also provide a computer program product. A computer program product comprising instructions, when executed on a computer, causes the computer to execute the traffic statistics method described in the above embodiments.
如图8所示,提供了终端使用虚拟SIM卡的应用环境。该应用环境包括服务器810和终端820。服务器810为虚拟网络运营商用于向终端820提供网络流量的服务器,可为云服务器。服务器810可向终端820提供虚拟用户身份识别模块(Subscriber Identity Module,SIM)卡信息以及使用该虚拟SIM卡实现网络通信的服务。终端810上可设置有虚拟SIM卡应用程序(Application,APP)821和软件开发工具包(Software Development Kit,SDK)822、虚拟SIM卡操作系统823以及虚拟SIM卡适配层824。该虚拟SIM卡APP821和SDK822、虚拟SIM卡操作系统823以及虚拟SIM卡适配层824均可设置于终端820上的应用处理器(Application Processor,AP)内。该服务器810可通过虚拟SIM卡APP821和SDK822,向虚拟SIM卡操作系统823发送虚拟SIM卡信息;虚拟SIM卡操作系统823可通过虚拟SIM卡适配层824,实现与设置在基带处理器(Baseband Processor,BP)内的射频通讯控制软件进行通信,以实现使用虚拟SIM卡进行网络通信。该终端820与图1中的终端可为同一终端。也就是,终端可通过虚拟卡从服务器810订购流量套餐,并激活流量套餐。As shown in FIG. 8 , an application environment in which a terminal uses a virtual SIM card is provided. The application environment includes a
其中,服务器810可以提供给终端820的虚拟SIM卡APP821相关接口,通过该接口实现和终端820之间的通信。该接口可包括用户及设备管理、套餐及订单管理、SIM资源的加密传输等接口。服务器810可以以REST ful应用程序编程接口(Application ProgrammingInterface,API)的方式向虚拟SIM卡APP821提供相关接口。虚拟SIM卡信息包括但不限于虚拟SIM卡的基本信息、虚拟SIM卡购买的订单信息、虚拟SIM卡的流量使用信息、期限信息等。The
图9为一个实施例中终端的部分架构图,该架构图中包含的模块为与虚拟SIM卡相关的模块。如图9所示,终端的应用层上可设置有虚拟SIM卡操作系统、虚拟SIM卡适配层、虚拟SIM卡APP和SDK以及电话本/信息模块。在框架层(Framework层)可设置有telephony接口层和无线接口层(Radio Interface Layer)java层。调制解调器(modem)可为由包含基带处理器、射频和其它外围芯片等组成的一个模块,为GSM/GPRS modem。其中,Telephony接口层用于提供通用的接口,虚拟SIM卡操作系统通过Telephony接口层与modem进行Socket交互,可实现判断是否有虚拟卡,虚拟卡的卡槽位置等。虚拟SIM卡操作系统通过虚拟SIM卡适配层与切换至虚拟SIM卡通道的modem进行Socket交互,可实现对虚拟卡的购买、激活、关闭,以及使用虚拟SIM卡进行网络通信功能等功能。可以理解的,图9中示出的结构,仅仅是与本申请方案相关的部分模块,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的模块,或者组合某些模块,或者具有不同的模块布置。比如还可在框架层上设置双卡管理模块,该双卡管理模块可与telephony接口层进行通信。FIG. 9 is a partial architecture diagram of a terminal in an embodiment, and the modules included in the architecture diagram are modules related to a virtual SIM card. As shown in FIG. 9 , the application layer of the terminal may be provided with a virtual SIM card operating system, a virtual SIM card adaptation layer, a virtual SIM card APP and SDK, and a phonebook/information module. The framework layer (Framework layer) can be provided with a telephony interface layer and a radio interface layer (Radio Interface Layer) java layer. A modem (modem) can be a module consisting of a baseband processor, a radio frequency and other peripheral chips, and is a GSM/GPRS modem. Among them, the Telephony interface layer is used to provide a common interface, and the virtual SIM card operating system communicates with the modem through the Telephony interface layer Socket, which can determine whether there is a virtual card, the card slot position of the virtual card, and so on. The virtual SIM card operating system performs Socket interaction with the modem switched to the virtual SIM card channel through the virtual SIM card adaptation layer, which can realize functions such as purchasing, activating, and closing the virtual card, and using the virtual SIM card for network communication functions. It can be understood that the structure shown in FIG. 9 is only a part of the modules related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. show more or fewer modules, or combine certain modules, or have a different arrangement of modules. For example, a dual-card management module can also be set on the framework layer, and the dual-card management module can communicate with the telephony interface layer.
在一个实施例中,终端可通过虚拟SIM卡APP向用户提供虚拟SIM卡的管理操作界面,并在侦测到作用于该管理操作界面上相关操作时,产生相应的虚拟SIM卡处理指令,并将该处理执行发送至虚拟SIM卡操作系统。该虚拟SIM卡操作系统可模拟真实SIM卡的系统逻辑,实现了用于进行网络通信所需的相关规范的协议和文件系统。虚拟SIM卡操作系统可接收来自虚拟SIM卡App的处理指令,通过虚拟SIM卡适配层向Modem发送与该处理指令对应的消息,并可接收modem作出的响应信息,共同实现使用虚拟SIM卡进行网络通信功能。其中,上述的相关规范的协议可包括国际标准化组织(International Organization forStandardization,ISO)7816以及3代合作项目(3rd Generation Partnership Project,3GPP)关于通用集成电路卡(Universal Integrated Circuit Card,UICC)和通用用户身份识别模块(Universal Subscriber Identity Module,USIM)等规范的协议。In one embodiment, the terminal can provide the user with a management operation interface of the virtual SIM card through the virtual SIM card APP, and when detecting a relevant operation acting on the management operation interface, generate a corresponding virtual SIM card processing instruction, and This processing execution is sent to the virtual SIM card operating system. The virtual SIM card operating system can simulate the system logic of a real SIM card, and implements a protocol and a file system of relevant specifications required for network communication. The virtual SIM card operating system can receive the processing instruction from the virtual SIM card App, send the message corresponding to the processing instruction to the Modem through the virtual SIM card adaptation layer, and can receive the response information from the modem to jointly realize the use of the virtual SIM card. Network communication function. Wherein, the above-mentioned agreement of relevant specifications may include International Organization for Standardization (ISO) 7816 and 3rd Generation Partnership Project (3GPP) on Universal Integrated Circuit Card (Universal Integrated Circuit Card, UICC) and universal user Standardized protocols such as the Universal Subscriber Identity Module (USIM).
在一个实施例中,该处理指令可包括对相应虚拟SIM卡的套餐购买指令、启用指令、失效指令以及关闭指令等。所实现的使用虚拟SIM卡进行网络通信的内容包括但不限于实现虚拟SIM卡信息的交互管理、状态的动态更新以及流量的统计和限速等,比如可实现对虚拟SIM卡信息的存储删除以及虚拟SIM卡的启用关闭等。In one embodiment, the processing instruction may include a package purchase instruction, an activation instruction, an invalidation instruction, and a closing instruction for the corresponding virtual SIM card, and the like. The content of using the virtual SIM card for network communication includes, but is not limited to, the interactive management of virtual SIM card information, the dynamic update of status, and the statistics and speed limit of traffic, such as storage and deletion of virtual SIM card information and Virtual SIM card is enabled and disabled, etc.
本申请实施例还提供了一种终端。如图10所示,为了便于说明,仅示出了与本申请实施例相关的部分,具体技术细节未揭示的,请参照本申请实施例方法部分。该终端可以为包括手机、平板电脑、PDA(Personal Digital Assistant,个人数字助理)、POS(Point ofSales,销售终端)、车载电脑、穿戴式设备等任意终端设备,以终端为手机为例:The embodiment of the present application also provides a terminal. As shown in FIG. 10 , for the convenience of description, only the parts related to the embodiments of the present application are shown, and the specific technical details are not disclosed, please refer to the method part of the embodiments of the present application. The terminal can be any terminal device including a mobile phone, tablet computer, PDA (Personal Digital Assistant, personal digital assistant), POS (Point of Sales, sales terminal), vehicle computer, wearable device and other terminal devices, taking the terminal as a mobile phone as an example:
图10为与本申请实施例提供的终端相关的手机的部分结构的框图。参考图10,手机包括:射频(Radio Frequency,RF)电路1010、存储器1020、输入单元1030、显示单元1040、传感器1050、音频电路1060、无线保真(wireless fidelity,WiFi)模块1070、处理器1080、以及电源1090等部件。本领域技术人员可以理解,图10所示的手机结构并不构成对手机的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。FIG. 10 is a block diagram of a partial structure of a mobile phone related to a terminal provided by an embodiment of the present application. Referring to FIG. 10 , the mobile phone includes: a radio frequency (RF)
其中,RF电路1010可用于收发信息或通话过程中,信号的接收和发送,可将基站的下行信息接收后,给处理器1080处理;也可以将上行的数据发送给基站。通常,RF电路包括但不限于天线、至少一个放大器、收发信机、耦合器、低噪声放大器(Low Noise Amplifier,LNA)、双工器等。此外,RF电路1010还可以通过无线通信与网络和其他设备通信。上述无线通信可以使用任一通信标准或协议,包括但不限于全球移动通讯系统(Global System ofMobile communication,GSM)、通用分组无线服务(General Packet Radio Service,GPRS)、码分多址(Code Division Multiple Access,CDMA)、宽带码分多址(Wideband CodeDivision Multiple Access,WCDMA)、长期演进(Long Term Evolution,LTE))、电子邮件、短消息服务(Short Messaging Service,SMS)等。The
存储器1020可用于存储软件程序以及模块,处理器1080通过运行存储在存储器1020的软件程序以及模块,从而执行手机的各种功能应用以及数据处理。存储器1020可主要包括程序存储区和数据存储区,其中,程序存储区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能的应用程序、图像播放功能的应用程序等)等;数据存储区可存储根据手机的使用所创建的数据(比如音频数据、通讯录等)等。此外,存储器1020可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The
输入单元1030可用于接收输入的数字或字符信息,以及产生与手机1000的用户设置以及功能控制有关的键信号输入。具体地,输入单元1030可包括触控面板1031以及其他输入设备1032。触控面板1031,也可称为触摸屏,可收集用户在其上或附近的触摸操作(比如用户使用手指、触笔等任何适合的物体或附件在触控面板1031上或在触控面板1031附近的操作),并根据预先设定的程式驱动相应的连接装置。在一个实施例中,触控面板1031可包括触摸检测装置和触摸控制器两个部分。其中,触摸检测装置检测用户的触摸方位,并检测触摸操作带来的信号,将信号传送给触摸控制器;触摸控制器从触摸检测装置上接收触摸信息,并将它转换成触点坐标,再送给处理器1080,并能接收处理器1080发来的命令并加以执行。此外,可以采用电阻式、电容式、红外线以及表面声波等多种类型实现触控面板1031。除了触控面板1031,输入单元1030还可以包括其他输入设备1032。具体地,其他输入设备1032可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)等中的一种或多种。The
显示单元1040可用于显示由用户输入的信息或提供给用户的信息以及手机的各种菜单。显示单元1040可包括显示面板1041。在一个实施例中,可以采用液晶显示器(Liquid Crystal Display,LCD)、有机发光二极管(Organic Light-Emitting Diode,OLED)等形式来配置显示面板1041。在一个实施例中,触控面板1031可覆盖显示面板1041,当触控面板1031检测到在其上或附近的触摸操作后,传送给处理器1080以确定触摸事件的类型,随后处理器1080根据触摸事件的类型在显示面板1041上提供相应的视觉输出。虽然在图10中,触控面板1031与显示面板1041是作为两个独立的部件来实现手机的输入和输入功能,但是在某些实施例中,可以将触控面板1031与显示面板1041集成而实现手机的输入和输出功能。The
手机1000还可包括至少一种传感器1050,比如光传感器、运动传感器以及其他传感器。具体地,光传感器可包括环境光传感器及接近传感器,其中,环境光传感器可根据环境光线的明暗来调节显示面板1041的亮度,接近传感器可在手机移动到耳边时,关闭显示面板1041和/或背光。运动传感器可包括加速度传感器,通过加速度传感器可检测各个方向上加速度的大小,静止时可检测出重力的大小及方向,可用于识别手机姿态的应用(比如横竖屏切换)、振动识别相关功能(比如计步器、敲击)等;此外,手机还可配置陀螺仪、气压计、湿度计、温度计、红外线传感器等其他传感器等。The
音频电路1060、扬声器1061和传声器1062可提供用户与手机之间的音频接口。音频电路1060可将接收到的音频数据转换后的电信号,传输到扬声器1061,由扬声器1061转换为声音信号输出;另一方面,传声器1062将收集的声音信号转换为电信号,由音频电路1060接收后转换为音频数据,再将音频数据输出处理器1080处理后,经RF电路1010可以发送给另一手机,或者将音频数据输出至存储器1020以便后续处理。
WiFi属于短距离无线传输技术,手机通过WiFi模块1070可以帮助用户收发电子邮件、浏览网页和访问流式媒体等,它为用户提供了无线的宽带互联网访问。虽然图10示出了WiFi模块1070,但是可以理解的是,其并不属于手机1000的必须构成,可以根据需要而省略。WiFi is a short-distance wireless transmission technology. The mobile phone can help users to send and receive emails, browse web pages, and access streaming media through the
处理器1080是手机的控制中心,利用各种接口和线路连接整个手机的各个部分,通过运行或执行存储在存储器1020内的软件程序和/或模块,以及调用存储在存储器1020内的数据,执行手机的各种功能和处理数据,从而对手机进行整体监控。在一个实施例中,处理器1080可包括一个或多个处理单元。在一个实施例中,处理器1080可集成应用处理器和处理器1080可集成应用处理器和调制解调器,其中,应用处理器主要处理操作系统、用户界面和应用程序等;调制解调器主要处理无线通信。可以理解的是,上述调制解调器也可以不集成到处理器1080中。比如,该处理器1080可集成应用处理器和基带处理器,基带处理器与和其它外围芯片等可组成调制解调器。The
手机1000还包括给各个部件供电的电源1090(比如电池),优选的,电源可以通过电源管理系统与处理器1080逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。The
在一个实施例中,手机1000还可以包括摄像头、蓝牙模块等。In one embodiment, the
在本申请实施例中,该移动终端所包括的处理器1080执行存储在存储器上的计算机程序时实现上述所描述的流量统计方法。In this embodiment of the present application, when the
本申请所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。易失性存储器可包括随机存取存储器(RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDR SDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)。Any reference to a memory, storage, database, or other medium as used herein may include non-volatile and/or volatile memory. Suitable nonvolatile memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which acts as external cache memory. By way of illustration and not limitation, RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous Link (Synchlink) DRAM (SLDRAM), Memory Bus (Rambus) Direct RAM (RDRAM), Direct Memory Bus Dynamic RAM (DRDRAM), and Memory Bus Dynamic RAM (RDRAM).
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the patent of the present application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the patent of the present application shall be subject to the appended claims.
Claims (14)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710924584.5A CN107484201B (en) | 2017-09-30 | 2017-09-30 | Traffic statistics method and device, terminal, and computer-readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710924584.5A CN107484201B (en) | 2017-09-30 | 2017-09-30 | Traffic statistics method and device, terminal, and computer-readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107484201A CN107484201A (en) | 2017-12-15 |
CN107484201B true CN107484201B (en) | 2020-08-14 |
Family
ID=60605025
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710924584.5A Active CN107484201B (en) | 2017-09-30 | 2017-09-30 | Traffic statistics method and device, terminal, and computer-readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107484201B (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110136452A (en) * | 2018-02-08 | 2019-08-16 | 杭州海康威视数字技术股份有限公司 | A kind of car statistics method and device |
CN109831358B (en) * | 2019-01-31 | 2021-01-01 | 北京达佳互联信息技术有限公司 | Client flow statistical method and device, server and readable storage medium |
CN112039721B (en) * | 2020-08-04 | 2022-03-18 | 紫光云(南京)数字技术有限公司 | Method and system for monitoring flow of elastic public network IP under public cloud platform |
CN114138810B (en) * | 2022-01-27 | 2022-04-12 | 中国民航信息网络股份有限公司 | Access flow statistical method and system |
Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102711139A (en) * | 2012-04-24 | 2012-10-03 | 华为终端有限公司 | Data flow counting method and terminal |
CN103188647A (en) * | 2011-12-29 | 2013-07-03 | 北京网秦天下科技有限公司 | Method and system for statistically analyzing and warning Internet surfing flow of mobile terminal |
CN103379461A (en) * | 2012-04-26 | 2013-10-30 | 华为终端有限公司 | Data service traffic statistical method and terminal |
CN104009892A (en) * | 2014-06-12 | 2014-08-27 | 北京奇虎科技有限公司 | Method, device and client for monitoring mobile terminal traffic |
US9065737B1 (en) * | 2012-09-27 | 2015-06-23 | Sprint Communications Company L.P. | Measuring traffic utilization |
CN104936221A (en) * | 2015-06-04 | 2015-09-23 | 北京奇虎科技有限公司 | Method and device for monitoring data flow in mobile terminal |
US9344344B2 (en) * | 2014-01-25 | 2016-05-17 | Cisco Technology, Inc. | Portable system for monitoring network flow attributes and associated methods |
CN106162576A (en) * | 2015-03-30 | 2016-11-23 | 腾讯科技(深圳)有限公司 | A kind of mobile terminal network flow indication method and device |
CN106302023A (en) * | 2016-08-22 | 2017-01-04 | 安徽瑞宏信息科技有限公司 | The network flow monitoring method of mobile terminal |
CN106603345A (en) * | 2017-02-04 | 2017-04-26 | 广东欧珀移动通信有限公司 | Method and device for monitoring application program usage flow and terminal |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US10212176B2 (en) * | 2014-06-23 | 2019-02-19 | Hewlett Packard Enterprise Development Lp | Entity group behavior profiling |
US10520531B2 (en) * | 2015-12-18 | 2019-12-31 | Locus Energy, Inc. | Time interval production measurement and energy storage performance analytics in renewable DC energy systems |
US10374926B2 (en) * | 2016-01-28 | 2019-08-06 | Oracle International Corporation | System and method for monitoring logical network traffic flows using a ternary content addressable memory in a high performance computing environment |
-
2017
- 2017-09-30 CN CN201710924584.5A patent/CN107484201B/en active Active
Patent Citations (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103188647A (en) * | 2011-12-29 | 2013-07-03 | 北京网秦天下科技有限公司 | Method and system for statistically analyzing and warning Internet surfing flow of mobile terminal |
CN102711139A (en) * | 2012-04-24 | 2012-10-03 | 华为终端有限公司 | Data flow counting method and terminal |
CN103379461A (en) * | 2012-04-26 | 2013-10-30 | 华为终端有限公司 | Data service traffic statistical method and terminal |
US9065737B1 (en) * | 2012-09-27 | 2015-06-23 | Sprint Communications Company L.P. | Measuring traffic utilization |
US9344344B2 (en) * | 2014-01-25 | 2016-05-17 | Cisco Technology, Inc. | Portable system for monitoring network flow attributes and associated methods |
CN104009892A (en) * | 2014-06-12 | 2014-08-27 | 北京奇虎科技有限公司 | Method, device and client for monitoring mobile terminal traffic |
CN106162576A (en) * | 2015-03-30 | 2016-11-23 | 腾讯科技(深圳)有限公司 | A kind of mobile terminal network flow indication method and device |
CN104936221A (en) * | 2015-06-04 | 2015-09-23 | 北京奇虎科技有限公司 | Method and device for monitoring data flow in mobile terminal |
CN106302023A (en) * | 2016-08-22 | 2017-01-04 | 安徽瑞宏信息科技有限公司 | The network flow monitoring method of mobile terminal |
CN106603345A (en) * | 2017-02-04 | 2017-04-26 | 广东欧珀移动通信有限公司 | Method and device for monitoring application program usage flow and terminal |
Also Published As
Publication number | Publication date |
---|---|
CN107484201A (en) | 2017-12-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107682910B (en) | Traffic resource sharing method and device, mobile terminal and storage medium | |
CN107734584A (en) | Method and device for network connection switching, computer equipment, and readable storage medium | |
CN104978176B (en) | Application program interface calling method, device and computer-readable storage medium | |
CN107484154B (en) | Data switching method and device, terminal and computer readable storage medium | |
CN107484201B (en) | Traffic statistics method and device, terminal, and computer-readable storage medium | |
CN107770746B (en) | Data processing method and device, computer equipment and computer readable storage medium | |
WO2019218124A1 (en) | Method for automatically switching sim cards, and electronic apparatus | |
CN107708084B (en) | Data processing method and device, computer equipment and computer readable storage medium | |
CN109445917B (en) | Application processing method and apparatus, electronic device, computer-readable storage medium | |
CN107707369A (en) | Method and device for traffic order management, computer equipment, and readable storage medium | |
CN107734495B (en) | Information processing method, device, storage medium and terminal | |
CN107682851A (en) | Information processing method, device, mobile terminal, and computer-readable storage medium | |
CN108733337B (en) | Screen display method and device, electronic equipment and computer readable storage medium | |
CN106658354B (en) | Data transmission method and equipment | |
CN107690131A (en) | Information processing method, device, mobile terminal, and computer-readable storage medium | |
CN108322602B (en) | Method, terminal and computer readable storage medium for processing application no response | |
CN107682833A (en) | Method and device for controlling flow use, mobile terminal and storage medium | |
CN106156097B (en) | Method and device for processing browser input records | |
CN107239493A (en) | Mobile terminal and its offline logs processing method, computer-readable recording medium | |
CN107623612B (en) | Flow display method and device, computer equipment and computer readable storage medium | |
CN108573169A (en) | Recent task list display method and device, storage medium, electronic device | |
CN107807820A (en) | Information processing method, device, mobile terminal and readable storage medium | |
CN107708107A (en) | Network communication processing method, device, storage medium and terminal | |
CN107743080B (en) | Flow statistical method and device, computer equipment and computer readable storage medium | |
CN108668016B (en) | Information processing method, device, mobile terminal and computer readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
CB02 | Change of applicant information | ||
CB02 | Change of applicant information |
Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18 Applicant after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd. Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18 Applicant before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS Corp.,Ltd. |
|
GR01 | Patent grant | ||
GR01 | Patent grant |