Embodiment
The embodiment of the application proposes a kind of flow statistical method of mobile device, and certain of adding up by user operates the flow triggered, to solve problems of the prior art.The method of the embodiment of the application can be applied on the mobile apparatus, is carried out collection and the traffic statistics of information by mobile device; Also can be applied on mobile device and server, be carried out the collection of information by mobile device, mobile device and server have worked in coordination with stream quantitative statistics.In embodiment one, the flow process of statistical method is carried out as shown in Figure 1 to the flow on mobile device.
Step 110, obtains the relevant information of user operation, comprises the time of origin of operation and runs object.
In the present embodiment, run object and refer to the object of user operation and traffic statistics, if what pay close attention to is the flow of certain application program, then can using application program as operation object; If what pay close attention to is the flow of certain process, then can using process as operation object.
The relevant information of user operation can be obtained by various mode, such as, by the interface of interception mobile device operation system learn user carried out which operation, the time of origin of operation and operation for operation object.
In one embodiment, the information of user operation can be obtained by the mode of screenshotss.Specifically, with predetermined period, screenshotss are carried out to mobile device, after removing the title bar of screen, obtain snapshot picture; The information of record snapshot picture, comprises the screenshotss time and runs object; By the change identification user operation of snapshot picture, when completing using user operation snapshot picture the screenshotss time and run object as user operation time of origin and run object.
Existing plug-in unit, third party's program etc. in prior art can be adopted to carry out screenshotss, process name or the application name of current active window can be obtained when screenshotss by operating system interface, be namely user operation for operation object.Such as, in Android (Android) system, the process name belonging to this Activity or application name in the attribute according to the Activity of Activity in operating system (interactive interface) storehouse the top, can be obtained.Due to usually the contents such as wireless signal strength, battery electric quantity, time can be shown in the title bar of mobile device screen; may affect and user operation is identified; thus after screenshotss, remove title bar obtain snapshot picture, the information such as the screenshotss time of record snapshot picture and operation object.According to the change of each two field picture, can identify user carried out what kind of operation, and when user operation is completed snapshot picture the screenshotss time and run object as user operation time of origin and run object.
Step 120, obtains the information that mobile device receives and sends message, comprises the size of message, time of origin and operation object.
Can mobile device reception be obtained by various mode and send the information of message, such as, or can send time of message, reception or send the operation object of message by the communication interface of retouching operation system, the size being obtained the message of all receptions and transmission by the mode of communication interface of plug-in unit interception operating system, reception, the message that these two kinds of modes can be received and dispatched all application programs carries out information gathering; If only need the flow adding up a few application program, also by the signal procedure of amendment application program, all messages that this application program receives and sends can be gathered, and receive or send the information such as time, process of message.
Retrievable message information can also comprise: type of message, as http (HyperTextTransferProtocol, HTML (Hypertext Markup Language)) message, socket (socket) message; Message content etc.
It should be noted that, step 110 and 120 does not have sequential relationship.
Step 130, according to time of origin, associates having the identical user operation of operation object with the message of its triggering.
Typically, operate when user runs object for certain, if this operation causes the changes in flow rate of mobile device, then this operation object can carry out the transmitting-receiving of message after this user operation completes.In other words, when having the identical user operation of operation object and the time of origin of message matches, can think that this user operation result in the transmitting-receiving of message, namely these messages are the flows that this user operation triggers.
Obtain in the execution mode of user's operation information in the mode by screenshotss, following method can be adopted to carry out associating of user operation and message: as setting the beginning associating the period when certain user operation is completed, using snapshot as the end of the constant time point of flow that is constant and mobile device within preset waiting time as the setting association period; The message of certain operation object transmitting-receiving in the setting association period is associated with the user operation for this operation object.Because a user operation may cause multiple business procedure, such as there is page reorientation etc., and these business procedures often along with display interface change and/or and network service provider between message interaction, when snapshot as constant and no longer include within a certain period of time flow occur time, can think that the flow that this user operation triggers terminates.
In one embodiment, can add up the flow occurred in the business procedure carried out with request-response modes further.In the business procedure of request-response modes, mobile device sends request message to network service provider; Network service provider responds this request, replys response message to mobile device.To the message of http type, mobile device sends HTTP_GET request or HTTP_POST request to network service provider, and network service provider replys http response; To the message of socket type, mobile device sends socket request to network service provider, and network service provider replys socket response.The request message of same business procedure in the message associated with certain user operation and response message can be mated, be added up the flow of this business procedure by request message and the size of corresponding response message.
Mating of request message and response message can be carried out according to time of origin.Specifically, in the message associated with certain user operation, transmit leg is identical with recipient, type of message is identical, the request message sent the earliest that not yet mates mates with the response message received the earliest not yet mated.In other words, giving tacit consent to the request message that same operation object sends the earliest to same network service provider will receive response at first, then can match according to the time of origin of request and response message.
Request message can also be adopted as add tagged mode to mate more accurately with response message.Specifically, in the predetermined field of the request message of mobile device transmission, the mark corresponding to this request message is added; Extract the predetermined field of response message, this response message is mated with the request message with same tag.Before mobile device sends request message, the predetermined field in request message adds the mark of this request message, and this mark corresponds to this request message and this request message and other request messages can be distinguished and comes.Network service provider after receiving this request message, the mark will carried in predetermined field in this request message in the response message of reply.Like this, after mobile device receives response message, by the mark of predetermined field and identifiable design, this is the response message corresponding to which request message.
Step 140, adds up by the size of associated message the flow that certain user operation triggers.
After packet sending and receiving user operation and this user operation triggered associates, namely the total amount of these association messages is the flow that this user operation triggers.
It should be noted that, the method for the embodiment of the present application can be applied on the mobile apparatus, is carried out information gathering and the traffic statistics of user operation and message by mobile device; Also can be applied on mobile device and server, the collection of information is carried out by mobile device, and worked in coordination with stream quantitative statistics by mobile device and server, such as, the collection of the information of user operation and message can be carried out by mobile device, the information of collection is uploaded onto the server, carries out associating and flowing quantitative statistics of user operation and message by server; The information gathering can carrying out user operation and message by mobile device with associate, the information after association is uploaded onto the server, completes stream quantitative statistics by server.For another example, to the execution mode being obtained user's operation information by screenshotss mode, the snapshot picture of collection and screenshotss time thereof can be sent to server with operation object by mobile device, the identification of user operation is carried out by server, also after completing user operation identifies, then user operation and relevant information thereof can be sent to server.In the embodiment of the application, between mobile device and server, carried out the transmission of information by mobile communications network.In the embodiment of the application, the specific implementation of the type of the kind of mobile device, the wireless communication protocol adopted between mobile device and server, mobile communications network and networking structure, server is not all limited.
Visible, by time of origin in the embodiment of the application, the same user operation of operation object is associated with the packet sending and receiving of its triggering, and then count the flow that certain user operation causes.Like this, Develop Application System tester accurately can locate the large link of traffic consumes, thus provides good precondition for reducing the flow of mobile device.
In the embodiment two of the application, mobile device carries out screenshotss with predetermined period, and snapshot picture and relevant information is uploaded onto the server; The information also upload server of message that mobile device gathers, by server carry out user operation identification, with the associating and traffic statistics of message.
In the present embodiment, mobile device gathers the flow process of screenshotss data as shown in Figure 2.
Step 210, judges whether predetermined period arrives, if so, performs step 220, otherwise continues to wait for.
Step 220, when predetermined period then, judge whether the flow of mobile device changes, if not change, then this cycle does not carry out screenshotss, goes to step next cycle of 210 waits; If changed, perform step 230.
Step 230, carries out screenshotss to the screen of mobile device, generates snapshot picture after removing title bar, the information such as the screenshotss time of record snapshot picture and operation object.
Step 240, judges whether the snapshot picture in this cycle changes compared with the snapshot picture in last cycle of preservation, if had, performs step 250; If no, the snapshot picture in this cycle is abandoned.
Step 250, preserves the snapshot picture in this cycle, and the information such as screenshotss time and operation object.
Step 260, judges whether to receive the instruction stopping traffic statistics, if received, performs step 270; If no, go to step next cycle of 210 waits.
Step 270, dwelling period screenshotss.
To the snapshot picture preserved and the information such as screenshotss time and operation object thereof, it regularly can be uploaded to server by mobile device, also can when its capacity reach certain setting size by its upload server.After upload server, delete snapshot picture and the screenshotss time thereof of preservation and run the information such as object.Deleting in time after information upload to avoid the memory space of mobile device to be taken in a large number.
By the communication interface of amendment mobile device operation system, when mobile device carries out the reception of message and sends, gather the information (size, time of origin, operation object, type of message etc. as message) of the message received and send and be saved in daily record.When the message information total amount of preserving reaches predetermined in limited time upper, the message information of preservation is uploaded onto the server.After uploading, delete the message information preserved.
Like this, server is according to the relevant information of the user operation received from mobile device, the information of message, according to time of origin and operation object, user operation can be associated with message, obtain according to the size of association message the flow that certain user operation triggers again, and can so that counting user operate the flow of certain the concrete business procedure generation caused.
In one example in which, server safeguards two tables, preserves the information that certain Android mobile device carrying out flow monitoring is uploaded.Wherein, table 1 is used for preserving the relevant information of snapshot picture that mobile device is uploaded, comprise the unique identification imei (InternationalMobileEquipmentIdentity, mobile device international identity code) of mobile device, run the title packageName of object, the interior perhaps access path of the superiors Activity when running version number versionName, sectional drawing time timestamp, the sectional drawing of object, sectional drawing image; Table 2 is used for preserving the information of message that mobile device is uploaded, comprise the unique identification imei of mobile device, run the title packageName of object, run the version number versionName of object, the transmit leg of message and recipient identify identity, message sends or receives timestamp timestamp, message request URL (UniformResoureLocator, uniform resource locator), type of message, message operating parameter, message content, message size etc.
On the server, according to the change identification user operation of snapshot picture.Take time as X-axis, sectional drawing image representative of consumer operated is arranged in X-axis with the flow of transmitting-receiving message, intuitively and clearly can show the message interaction process that certain user operation triggers and flow.Such as, the flow that the delivery operation that Fig. 3 illustrates user triggers, on the snapshot picture in left side, page display is payment code, on the snapshot picture on right side, page display is Alipay wallet homepage, therefore the payment of user operation can be drawn, after payment terminates, the page has jumped to Alipay wallet homepage from payment code, flow during this period, light grey water column represents the flow that request message consumes, approximately consume 10KB, and Dark grey water column represents the flow that response message during this period consumes, be approximately 7KB, the flow of about 17KB is consumed from payment code switchback Alipay wallet homepage.
Realize corresponding with above-mentioned flow process, the flow statistic device that embodiment still provides a kind of mobile device of the application, can apply on the mobile apparatus, also can certain applications on the mobile apparatus, certain applications are on the server.This device can pass through software simulating, also can be realized by the mode of hardware or software and hardware combining.For software simulating, as the device on logical meaning, be by the CPU of mobile device or server the computer program instructions of correspondence read in internal memory to run to be formed.Say from hardware view; except the CPU shown in Fig. 4, internal memory and nonvolatile memory; the mobile device at this device place also comprises other hardware such as the chip for carrying out wireless signal transmitting-receiving usually, and the server at this device place also comprises other hardware such as the board for realizing network communicating function usually.
Figure 5 shows that the flow statistic device of a kind of mobile device that the present embodiment provides, comprise operation information acquisition unit, message information acquiring unit, associative cell and statistic unit, wherein: operation information acquisition unit, for obtaining the relevant information of user operation, comprises the time of origin of operation and runs object; The information that message information acquiring unit receives for obtaining mobile device and sends message, comprises the size of message, time of origin and operation object; Associative cell is used for according to time of origin, associates having the identical user operation of operation object with the message of its triggering; The flow that statistic unit triggers for being added up certain user operation by the size of associated message.
Described operation information acquisition unit may further include cycle screen capture module, screenshotss information logging modle and operation identification module, wherein: cycle screen capture module is used for carrying out screenshotss with predetermined period to mobile device, obtains snapshot picture after removing the title bar of screen; Screenshotss information logging modle, for recording the information of snapshot picture, comprises the screenshotss time and runs object; Operation identification module is used for by the change identification user operation of snapshot picture, when completing using user operation snapshot picture the screenshotss time and run object as the time of origin of user operation with run object.
Optionally, described associative cell specifically for: the user operation of object will be run for certain, and associate with setting the message that in the period, described operation object is received and dispatched and associate; Describedly set the association period as beginning when completing with described user operation, until snapshot is constant as flow that is constant and mobile device within preset waiting time.
Described device can also comprise cancels screenshotss unit, screenshotss image storing unit and screenshotss stop element, wherein: cancel screenshotss unit and be used for working as the predetermined period time then, if the flow of mobile device does not change, then this cycle does not carry out screenshotss, waits for next cycle; Screenshotss image storing unit is used for when the snapshot picture in this cycle changes compared with the snapshot picture in last cycle of preservation, preserves the snapshot picture in this cycle; Otherwise abandoned; Screenshotss stop element is used for after receiving the instruction stopping traffic statistics, dwelling period screenshotss.
Described device can also comprise: screenshotss uploading unit, for regularly being uploaded onto the server by the snapshot that mobile device is preserved picture, and after uploading, deletes the snapshot picture of preservation.
Optionally, described message information acquiring unit specifically for: by the communication interface of retouching operation system, by the communication interface of plug-in unit interception operating system or the signal procedure being run object by amendment, obtain the information of mobile device transmitting-receiving message.
In a kind of execution mode, the message that described mobile device sends comprises request message, and the message that described mobile device receives comprises response message; Described device also comprises request and responses match unit and business procedure flow cell, wherein: ask to be used for the request message of same business procedure in the message associated with certain user operation and response message to mate with responses match unit; Business procedure flow cell is used for the flow being added up described business procedure by request message and the size of corresponding response message.
The information of described message can also comprise type of message; Described type of message comprises: HTML (Hypertext Markup Language) http message and socket message; Described request and responses match unit specifically for: in the message associated with certain user operation, transmit leg is identical with recipient, type of message is identical, the request message sent the earliest that not yet mates mates with the response message received the earliest not yet mated.
Optionally, described request and responses match unit comprise marking and add module and marker recognition module, wherein: mark adds module and is used for adding the mark corresponding to this request message in the predetermined field of the request message sent at mobile device; Described response message, for extracting the predetermined field of response message, mates with the request message with same tag by marker recognition module.
Optionally, described device also comprises message information storage unit, message information uploading unit and message information delete cells, wherein: message information storage unit is for preserving the information of mobile device transmitting-receiving message; Message information uploading unit reaches predetermined in limited time upper for the total amount working as preserved message information, is uploaded onto the server by the message information of preservation; Message information delete cells is used for the message information deleting preservation after uploading.
As can be seen from the execution mode of above various method and apparatus, can only add up the flow total value of certain application program in certain hour section relative to prior art, the embodiment of the application utilizes time of origin and runs object, transmitting-receiving message user operation and its caused associates, thus the flow that certain user operation triggers can be counted, make the link place tested and developer carries out more fast, location traffic consumes is large more accurately.
In one typically configuration, computing equipment comprises one or more processor (CPU), input/output interface, network interface and internal memory.
Internal memory may comprise the volatile memory in computer-readable medium, and the forms such as random access memory (RAM) and/or Nonvolatile memory, as read-only memory (ROM) or flash memory (flashRAM).Internal memory is the example of computer-readable medium.
Computer-readable medium comprises permanent and impermanency, removable and non-removable media can be stored to realize information by any method or technology.Information can be computer-readable instruction, data structure, the module of program or other data.The example of the storage medium of computer comprises, but be not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic random access memory (DRAM), the random access memory (RAM) of other types, read-only memory (ROM), Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette tape, tape magnetic rigid disk stores or other magnetic storage apparatus or any other non-transmitting medium, can be used for storing the information can accessed by computing equipment.According to defining herein, computer-readable medium does not comprise temporary computer readable media (transitorymedia), as data-signal and the carrier wave of modulation.
Also it should be noted that, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, commodity or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, commodity or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, commodity or the equipment comprising described key element and also there is other identical element.
It will be understood by those skilled in the art that the embodiment of the application can be provided as method, system or computer program.Therefore, the application can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the application can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disc store, CD-ROM, optical memory etc.) of computer usable program code.
The foregoing is only the preferred embodiment of the application, not in order to limit the application, within all spirit in the application and principle, any amendment made, equivalent replacements, improvement etc., all should be included within scope that the application protects.