Specific implementation mode
Embodiments herein proposes that a kind of flow statistical method of mobile device, statistics operate triggering by some of user
Flow, to solve problems of the prior art.The method of embodiments herein can apply on the mobile apparatus, by
Acquisition and traffic statistics of the mobile device into row information;Can also apply in mobile device and server, by mobile device into
The statistics of flow is completed in the acquisition of row information, mobile device and server collaboration.In embodiment one, to the flow in mobile device
The flow for carrying out statistical method is as shown in Figure 1.
Step 110, the relevant information of user's operation, including the time of origin of operation and operation object are obtained.
In the present embodiment, operation object refers to the object of user's operation and traffic statistics, if being concerned with some applies journey
The flow of sequence, then can be using application program as operation object;If being concerned with the flow of some process, process can be made
To run object.
The relevant information of user's operation can be obtained by various modes, for example, by intercepting mobile device operation system
The interface of system learns that user has carried out which operation, the time of origin of operation and the targeted operation object of operation.
In one embodiment, the information of user's operation can be obtained by way of screenshotss.Specifically, with pre-
Fixed cycle carries out screenshotss to mobile device, and screenshotss image is obtained after removing the title bar of screen;Record the information of screenshotss image, packet
Include screenshotss time and operation object;User's operation, screenshotss image when being completed with user's operation are identified by the variation of screenshotss image
The screenshotss time and operation object as user's operation time of origin and run object.
Existing plug-in unit, third equation etc. in the prior art may be used and carry out screenshotss, be by operating in screenshotss
System interface can obtain the process name or application name of current active window, be the targeted operation object of user's operation.
For example, in Android (Android) system, according to (interactive interface) storehouses of Activity in operating system the top
The process name belonging to the Activity or application name can be obtained in the attribute of Activity.Due to mobile device screen
The contents such as wireless signal strength, battery capacity, time would generally be shown in title bar, may influence to know user's operation
Not, thus after screenshotss it removes title bar and obtains screenshotss image, record the information such as screenshotss time and the operation object of screenshotss image.
According to the variation of each frame image, screenshotss image when can identify what kind of operation user has carried out, and user's operation being completed
The time of origin and operation object of screenshotss time and operation object as user's operation.
Step 120, the information that mobile device sends and receivees message, including the size of message, time of origin and fortune are obtained
Row object.
The information that mobile device sends and receivees message can be obtained by various modes, for example, can pass through modification
The communication interface of operating system obtains all send and receive in such a way that plug-in unit intercepts the communication interface of operating system
The size of message, the time of reception or transmission message, reception or the operation object for sending message, both modes can be to all
The message of application program transmitting-receiving carries out information collection;If only needing to count the flow of a few application program, can also lead to
The signal procedure for crossing modification application program to acquire all messages that the application program sends and receivees, and is received or is sent
The information such as time, the process of message.
Retrievable message information can also include:Type of message, such as http (HyperText Transfer
Protocol, hypertext transfer protocol) 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, the user's operation with identical operation object has been associated with the message that it is triggered
Come.
Typically, it is operated when user runs object for some, if the operation leads to the flow of mobile device
Variation, then the operation object can carry out the transmitting-receiving of message after the completion of the user's operation.In other words, when with identical operation object
User's operation and the time of origin of message when matching, it is believed that be the transmitting-receiving that the user's operation results in message, these
Message is the flow of user's operation triggering.
In the embodiment to obtain user's operation information by way of screenshotss, may be used following method come into
Row user's operation is associated with message:As the beginning of setting association period when some user's operation is completed, screenshotss image
End of the constant time point of constant and the mobile device within preset waiting time flow as the setting association period;Setting
The message of some operation object transmitting-receiving is associated with the user's operation for the operation object in the association period.Due to a use
Family operation may lead to multiple business procedures, such as page reorientation occurs etc., and these business procedures are usually associated with display
The variation at interface and/or the message interaction between network service provider, when screenshotss image is constant and within a certain period of time
When occurring there is no flow, it is believed that the flow that the user's operation is triggered is over.
It in one embodiment, can be further to the stream to occur in the business procedure of request-response modes progress
Amount is counted.In the business procedure of request-response modes, mobile device sends request message to network service provider;Net
Network service provider responds the request, and response message is replied to mobile device.To the message of http types, mobile device
HTTP_GET requests are sent to network service provider or HTTP_POST requests, network service provider reply http response;
To the message of socket types, mobile device sends socket requests to network service provider, and network service provider is replied
Socket is responded.Can by with the request message of same business procedure in the associated message of some user's operation and response message into
Row matching, the flow of the business procedure is counted by the size of request message and corresponding response message.
The matching of message and response message can be made requests on according to time of origin.Specifically, with some user
It operates in associated message, by sender is identical with recipient, type of message is identical, the not yet matched request report sent out earliest
It is literary to be matched with the not yet matched response message received earliest.In other words, the same operation object is given tacit consent to the same net
The request message that network service provider is sent out earliest will receive response at first, then can according to request and response message generation when
Between matched.
The mode that can also be adopted as request message addition label to carry out more accurate match with response message.Specifically
For, label of the addition corresponding to the request message in the scheduled field for the request message that mobile device is sent;Extraction response
The scheduled field of message matches the response message with the request message with same tag.It is asked in mobile device transmission
Before seeking message, the scheduled field in request message adds the label of the request message, which corresponds to the request message simultaneously
And the request message and other request messages can be distinguished.Network service provider is replied after receiving the request message
Response message in by the label in carrying the request message in scheduled field.In this way, after mobile device receives response message,
It can recognize that this corresponds to the response message of which request message by the label of scheduled field.
Step 140, the flow that some user's operation is triggered is counted by the size of associated message.
After associating user's operation with the packet sending and receiving that the user's operation triggers, the total amount of these association messages is
It is the flow of user's operation triggering.
It should be noted that the method for the embodiment of the present application can be applied on the mobile apparatus, used by mobile device
Family operates the information collection and traffic statistics with message;Can also apply in mobile device and server, by mobile device into
The acquisition of row information, and the statistics of flow is completed by mobile device and server collaboration, for example, can be used by mobile device
Family operates the acquisition with the information of message, and the information of acquisition is uploaded onto the server, and user's operation and message are carried out by server
Association and flow statistics;User's operation and the information collection of message can be carried out by mobile device and is associated with, and will be associated with
Information afterwards is uploaded onto the server, and the statistics of flow is completed by server.For another example, to obtaining user's operation letter by screenshotss mode
The screenshotss image of acquisition and its screenshotss time and operation object can be sent to server by the embodiment of breath, mobile device,
The identification of user's operation is carried out by server, can also be believed after completing user's operation identification, then by user's operation and its correlation
Breath is sent to server.In embodiments herein, by mobile communications network into row information between mobile device and server
Transmission.In embodiments herein between the type of mobile device, mobile device and server used wireless communication
Agreement, the type of mobile communications network and networking structure, server specific implementation do not limit.
As it can be seen that by time of origin in embodiments herein, the user's operation of same operation object is triggered with it
Packet sending and receiving associates, and then counts the flow caused by some user's operation.In this way, the exploitation tester of application program
Member can be accurately positioned flow and consume big link, to provide good precondition for the flow of reduction mobile device.
In embodiments herein two, mobile device carries out screenshotss with predetermined period, and by screenshotss image and relevant information
It uploads onto the server;The information also upload server of the message of mobile device acquisition, by server carry out user's operation identification,
With message be associated with and traffic statistics.
In the present embodiment, the flow that mobile device acquires screenshotss data is as shown in Figure 2.
Step 210, judge whether predetermined period has arrived, if so, executing step 220, otherwise continue waiting for.
Step 220, when predetermined period then, judge whether the flow of mobile device changes, if do not changed, this
Period without screenshotss, goes to step 210 waitings next period;If changed, step 230 is executed.
Step 230, screenshotss are carried out to the screen of mobile device, generates screenshotss image after removing title bar, records snapshot
The information such as the screenshotss time of picture and operation object.
Step 240, judge whether the screenshotss image in this period has compared with the screenshotss image in the last one period of preservation
Variation, if so, executing step 250;If not provided, the screenshotss image in this period is abandoned.
Step 250, the screenshotss image and its information such as screenshotss time and operation object in this period are preserved.
Step 260, judge whether to receive the instruction for terminating traffic statistics, if received, execute step 270;If not provided,
Go to step 210 waitings next period.
Step 270, dwelling period screenshotss.
The information such as screenshotss image and its screenshotss time and operation object to preservation, mobile device can periodically upload it
To server, can also reach its upload server when some is sized in its capacity.After upload server, delete
Except the information such as the screenshotss image of preservation and its screenshotss time and operation object.Being deleted in time after upload information can be to avoid movement
The memory space of equipment is largely occupied.
By change mobile device operation system communication interface, when mobile device carry out when sending and receiving of message,
It acquires the information (size of such as message, time of origin, operation object, type of message) of the message sended and received and is saved in
In daily record.When the message information total amount of preservation reaches the predetermined upper limit, the message information of preservation is uploaded onto the server.It is uploading
Afterwards, the message information of preservation is deleted.
In this way, the relevant information for the user's operation that server is received according to slave mobile device, the information of message, you can according to
Time of origin and operation object associate user's operation with message, some user is obtained further according to the size of association message
The triggered flow of operation, and the flow that some caused specific business procedure occurs can be operated by counting user in turn.
In one example, two tables are safeguarded on server, are set to preserve the Android movements that some carries out flow monitoring
The standby information uploaded.Wherein, table 1 is used for preserving the relevant information of the screenshotss image of mobile device upload, including mobile device
Unique mark imei (International Mobile Equipment Identity, mobile device international identity code), operation
When the title packageName of object, the version number versionName for running object, sectional drawing time timestamp, sectional drawing
The interior perhaps access path of top layer Activity, sectional drawing image;Table 2 is used for preserving the information of the message of mobile device upload,
The title packageName of unique mark imei, operation object including mobile device, the version number for running object
VersionName, the sender of message and recipient's mark identity, message transmission or the timestamp timestamp received,
Message request URL (Uniform Resoure Locator, uniform resource locator), type of message, message operating parameter, report
Literary content, message size etc..
On the server, user's operation is identified according to the variation of screenshotss image.Using the time as X-axis, user's operation will be represented
Sectional drawing image and receive and dispatch the flow of message and be arranged on the x axis, can be intuitive and clearly show that some user's operation is triggered
Message interaction process and flow.For example, Fig. 3 illustrates the flow that the delivery operation of user is triggered, the screenshotss in left side
The page is shown payment code on image, and the page is shown Alipay wallet homepage on the screenshotss image on right side, therefore can be with
The payment for obtaining user's operation, the page has jumped to Alipay wallet homepage from payment code after payment, during this period
Flow, light grey water column represent the flow of request message consumption, have consumed about 10KB, and Dark grey water column is represented and rung during this period
The flow for answering message to consume, about 7KB consume the flow of about 17KB from payment code switchback Alipay wallet homepage.
Corresponding with the realization of above-mentioned flow, embodiments herein additionally provides a kind of flow statistic device of mobile device,
Can apply on the mobile apparatus, can also certain applications on the mobile apparatus, certain applications are on the server.The device can be with
By software realization, can also be realized by way of hardware or software and hardware combining.For implemented in software, anticipate as logic
Device in justice is to read corresponding computer program instructions in memory by the CPU of mobile device or server to run
It is formed.For hardware view, other than CPU shown in Fig. 4, memory and nonvolatile memory, where the device
Mobile device also typically include other hardware such as the chip for carrying out wireless signal transmitting-receiving, the server where the device is logical
Often further include for realizing other hardware such as board of network communicating function.
Fig. 5 show a kind of flow statistic device of mobile device provided in this embodiment, including operation information acquisition list
Member, message information acquiring unit, associative cell and statistic unit, wherein:Operation information acquisition unit is for obtaining user's operation
Relevant information, including the time of origin of operation and operation object;Message information acquiring unit is for obtaining mobile device reception
With the information for sending message, including the size of message, time of origin and operation object;Associative cell is used for according to time of origin,
User's operation with identical operation object is associated with the message that it is triggered;Statistic unit is used for by associated message
Size count the flow that some user's operation is triggered.
The operation information acquisition unit may further include period screen capture module, screenshotss information logging modle and operation
Identification module, wherein:Period screen capture module is used for predetermined period to mobile device progress screenshotss, after the title bar for removing screen
Obtain screenshotss image;Screenshotss information logging modle is used to record the information of screenshotss image, including screenshotss time and operation object;Behaviour
Make identification module for by the variation of screenshotss image identification user's operation, when being completed with user's operation when the screenshotss of screenshotss image
Between and operation object as user's operation time of origin and run object.
Optionally, the associative cell is specifically used for:The user's operation of object will be run for some, when being associated with setting
The message of the operation object transmitting-receiving is associated in section;It is described to set the association period when being completed with the user's operation as the beginning,
Until screenshotss image is constant and the flow of mobile device is constant within preset waiting time.
Described device can also include cancel screenshotss units, screenshotss image storing unit and screenshotss stop unit, wherein:It takes
The screenshotss unit that disappears is used to work as the predetermined period time then, if the flow of mobile device does not change, this period is without cutting
Screen, waits for next period;Screenshotss image storing unit is used for the screenshotss image when this period and the last one period of preservation
Screenshotss image preserves the screenshotss image in this period compared to when changing;Otherwise it is abandoned;Screenshotss stop unit is for receiving
After the instruction for terminating traffic statistics, dwelling period screenshotss.
Described device can also include:Screenshotss uploading unit, the screenshotss image for will be preserved in mobile device are regular
Server is passed to, and deletes the screenshotss image of preservation after upload.
Optionally, the message information acquiring unit is specifically used for:By changing the communication interface of operating system, by inserting
Part intercepts the communication interface of operating system or runs the signal procedure of object by modification, transmits and receive telegrams to obtain mobile device
The information of text.
In a kind of embodiment, the message that the mobile device is sent includes request message, what the mobile device received
Message includes response message;Described device further includes request and responds matching unit and business procedure flow cell, wherein:Request
It is used to report with the request message of same business procedure in the associated message of some user's operation and response with response matching unit
Text is matched;Business procedure flow cell is used to count the business mistake by the size of request message and corresponding response message
The flow of journey.
The information of the message can also include type of message;The type of message includes:Hypertext transfer protocol http
Message and socket message;The request is specifically used for response matching unit:Associated with some user's operation
In message, by sender and recipient are identical, type of message is identical, the not yet matched request message sent out earliest with not yet
The response message received earliest matched is matched.
Optionally, the request includes label add module and marker recognition module with response matching unit, wherein:Label
Add module in the scheduled field for the request message that mobile device is sent for adding the label corresponding to the request message;Mark
Note identification module is used to extract the scheduled field of response message, by the response message and the request message with same tag into
Row matching.
Optionally, described device further includes that message information storage unit, message information uploading unit and message information are deleted
Unit, wherein:Message information storage unit is used to preserve the information of mobile device transmitting-receiving message;Message information uploading unit is used for
When the total amount of the message information preserved reaches the predetermined upper limit, the message information of preservation is uploaded onto the server;Message information
Deleting unit is used to delete the message information of preservation after upload.
As can be seen that it compared with the existing technology can only be to some application from the embodiment of any of the above method and apparatus
The flow total value of program within a certain period of time is counted, and embodiments herein, will using time of origin and operation object
User's operation is associated with transmitting-receiving message caused by it, so as to count the flow that some user's operation is triggered, is made
It must test and developer's progress more rapidly, more accurately positions flow and consumes big link place.
In a typical configuration, computing device includes one or more processors (CPU), input/output interface, net
Network interface and memory.
Memory may include computer-readable medium in volatile memory, random access memory (RAM) and/or
The forms such as Nonvolatile memory, such as read-only memory (ROM) or flash memory (flash RAM).Memory is computer-readable medium
Example.
Computer-readable medium includes permanent and non-permanent, removable and non-removable media can be by any method
Or technology realizes information storage.Information can be computer-readable instruction, data structure, the module of program or other data.
The example of the storage medium of computer includes, but are not limited to phase transition internal memory (PRAM), static RAM (SRAM), moves
State random access memory (DRAM), other kinds of random access memory (RAM), read-only memory (ROM), electric erasable
Programmable read only memory (EEPROM), fast flash memory bank or other memory techniques, read-only disc read only memory (CD-ROM) (CD-ROM),
Digital versatile disc (DVD) or other optical storages, magnetic tape cassette, tape magnetic disk storage or other magnetic storage apparatus
Or any other non-transmission medium, it can be used for storage and can be accessed by a computing device information.As defined in this article, it calculates
Machine readable medium does not include temporary computer readable media (transitory media), such as data-signal and carrier wave of modulation.
It should also be noted that, the terms "include", "comprise" or its any other variant are intended to nonexcludability
Including so that process, method, commodity or equipment including a series of elements include not only those elements, but also wrap
Include other elements that are not explicitly listed, or further include for this process, method, commodity or equipment intrinsic want
Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that wanted including described
There is also other identical elements in the process of element, method, commodity or equipment.
It will be understood by those skilled in the art that embodiments herein can be provided as method, system or computer program product.
Therefore, complete hardware embodiment, complete software embodiment or embodiment combining software and hardware aspects can be used in the application
Form.It is deposited moreover, the application can be used to can be used in the computer that one or more wherein includes computer usable program code
The shape for the computer program product implemented on storage media (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.)
Formula.
The foregoing is merely the preferred embodiments of the application, not limiting the application, all essences in the application
With within principle, any modification, equivalent substitution, improvement and etc. done should be included within the scope of the application protection god.