CN108809763B - Network performance parameter acquisition method, terminal device and storage medium - Google Patents

Network performance parameter acquisition method, terminal device and storage medium Download PDF

Info

Publication number
CN108809763B
CN108809763B CN201810611644.2A CN201810611644A CN108809763B CN 108809763 B CN108809763 B CN 108809763B CN 201810611644 A CN201810611644 A CN 201810611644A CN 108809763 B CN108809763 B CN 108809763B
Authority
CN
China
Prior art keywords
nsurlsession
class
classification
callback
network
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
Application number
CN201810611644.2A
Other languages
Chinese (zh)
Other versions
CN108809763A (en
Inventor
张骏
张文明
陈少杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201810611644.2A priority Critical patent/CN108809763B/en
Publication of CN108809763A publication Critical patent/CN108809763A/en
Application granted granted Critical
Publication of CN108809763B publication Critical patent/CN108809763B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Abstract

The invention discloses a network performance parameter acquisition method, a terminal device and a storage medium, which are suitable for the field of application development. The method provided by the invention comprises the following steps: defining classification of NSURLSession, and setting an exchange method of network requests in the classification; when the terminal starts a predetermined application, acquiring a proxy object in NSURLSession through the classification, and dynamically exchanging a callback method in the proxy object; and when the network request of the predetermined application is detected, storing the network request into a predefined dictionary through an exchanged callback method. According to the invention, by defining the classification and exchange method, the callback function is dynamically replaced after the proxy object is obtained, so that the network performance parameters are efficiently and quickly acquired without influencing the normal function of the program in the IOS, and further, better service is provided for the user according to the performance parameters, and the user experience is ensured.

Description

Network performance parameter acquisition method, terminal device and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a network performance parameter acquisition method, a terminal device, and a storage medium.
Background
In an APM (application performance management) platform, monitoring and management of application key business can ensure that better service is provided for users. The network performance of the application is taken as an important ring, and the network performance parameters of the application are monitored and collected, so that important basis can be provided for improving network time consumption, request errors and the like.
Currently, there are two commonly used methods for network performance monitoring in the industry, including NSURLProtocol and fisherhook CFNetwork. The former is a method for intercepting all network requests in the IOS, and because the NSURLProtocol method is adopted and the URL Loading System needs to be reloaded, the response speed is slow, the performance is poor, NSURLSession needs to be created again for each request, and repeated reconstruction may cause System crash; the latter method of exchanging CFNetwork exchanges the private API and applies the shelf function of APP, and the memory consumption of the method is large, and the application use is influenced.
Therefore, it is necessary to provide a performance parameter collecting method that is efficient and simple and does not affect the original functions of the application.
Disclosure of Invention
In view of this, embodiments of the present invention provide a network performance parameter acquisition method, a terminal device, and a storage medium, so as to solve the problems that the existing acquisition method has poor performance and affects the original functions.
In a first aspect of the embodiments of the present invention, a method for acquiring network performance parameters is provided, including:
defining classification of NSURLSession, and setting an exchange method of network requests in the classification;
when the terminal starts a predetermined application, acquiring a proxy object in NSURLSession through the classification, and dynamically exchanging a callback method in the proxy object;
and when the network request of the predetermined application is detected, storing the network request into a predefined dictionary through an exchanged callback method.
In a second aspect of the embodiments of the present invention, a network performance parameter terminal apparatus is provided, including:
a definition module: a classification for defining NSURLSession, and setting an exchange method of network requests in the classification;
a switching module: when the terminal starts a predetermined application, the proxy object in NSURLSession is acquired through the classification, and a callback method in the proxy object is dynamically exchanged;
a storage module: and when the network request of the predetermined application is detected, the network request is stored into a predefined dictionary through an exchanged callback method.
In a third aspect of the embodiments of the present invention, there is provided a terminal apparatus, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the steps of the method according to the first aspect of the embodiments of the present invention.
In a fourth aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of the method provided in the first aspect of the embodiments of the present invention.
In a fifth aspect of embodiments of the present invention, a computer program product is provided, the computer program product comprising a computer program that, when executed by one or more processors, performs the steps of the method provided in the first aspect of embodiments of the present invention.
In the embodiment of the invention, the switching method is defined in the classification by defining the classification of NSURLSession, the switching method is realized when the APP is started, the callback function is replaced, and then the request parameter is acquired through the replaced callback function when the network requests. Therefore, under the condition that the normal function of the program in the IOS is not influenced, the network performance parameters are efficiently and quickly acquired, better service is provided for the user according to the performance parameters, and the user experience is guaranteed.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a flowchart of an embodiment of a network performance parameter acquisition method according to an embodiment of the present invention;
fig. 2 is a flowchart of another embodiment of a network performance parameter acquisition method according to an embodiment of the present invention;
fig. 3 is a schematic structural diagram of a network performance parameter acquisition terminal device according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a network performance parameter acquisition method, a terminal device and a storage medium, which are used for quickly and accurately pushing hot spot live broadcast.
In order to make the objects, features and advantages of the present invention more obvious and understandable, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the embodiments described below are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The first embodiment is as follows:
referring to fig. 1, a schematic flow chart of a network performance parameter acquisition method according to an embodiment of the present invention includes the following steps:
s101, defining classification of NSURLSession, and setting an exchange method of network requests in the classification;
the NSURLSession is a group of classes used for processing HTTP/HTTPS-based requests, can manage network requests and uniformly configure request tasks. The classification is used for adding a new method on the basis of the original classification, expanding the attribute and specifically representing a structural body pointer pointing to the classification. In the embodiment of the invention, classification of the system class NSURLSession is defined, and the function of NSURLSession can be expanded, thereby realizing a customized exchange method.
The exchange method is specifically a self-defined tool class, and a hookmethod is defined in the tool class and is used for replacing the original class, the original class method, the replaced class and the replaced class method. The above replacement is mainly realized by a runtime function.
S102, when a terminal starts a preset application, acquiring a proxy object in NSURLSession through the classification, and dynamically exchanging a callback method in the proxy object;
the preset application starting means that the terminal clicks and opens the APP or a certain section of program, namely, when the APP or the certain section of program is in a running state, the replacement operation is started. The proxy object is an instantiated network request and an object of NSURLSession from new, and the object can process network interaction tasks and information content. The callback method is a callback function executed by a system in a default way, and specifically comprises a method for creating NSURLSession, a call after network performance parameters are collected and a call after a network request is completed.
And if the replacement is not completed, the corresponding callback function is preset and is injected into the proxy object, so that the network request of the application program is prevented from being influenced because the replacement is unsuccessful.
Optionally, a tool class is defined, and the replacement of the nsursursion creation method and the replacement of the proxy object callback method are respectively defined in the tool class. The tool class is mainly used for realizing the replacement of the proxy object and the replacement of the callback method, the proxy object after the replacement can acquire the original callback method and then exchange the callback method, and the exchanged callback method can transmit network request information. In the embodiment of the invention, a class method for replacing the proxy object and a class method for replacing the callback method are directly defined in the tool class, and both the two class methods are executed in a runtime function, so that dynamic exchange can be ensured, and a network request is acquired on the basis of not influencing an original code.
Optionally, a class is customized, the class is implemented in a single instance, and an exchange method for implementing the classification in the class is set. The realization under the singleton mode can ensure that only one instance exists in one class, provide a unique access point and reduce the expenditure of the memory. In the embodiment of the invention, the self-defined class can be used for setting the starting of the exchange, and the extension function of the classification is realized inside the self-defined class for carrying out the dynamic exchange.
Preferably, the method further comprises creating an asynchronous serial queue inside the class, and putting all methods in the class into the asynchronous serial queue. The asynchronous serial queue is created, so that the blocking problem caused by multi-thread concurrency can be avoided, and the influence of synchronous operation is reduced.
S103, when the network request of the predetermined application is detected, the network request is stored in a predefined dictionary through an exchanged callback method.
And every time the application program initiates a network request, the request parameters are captured by the replaced callback method, the intercepted information is transmitted out and stored in a specific form, the information is the network request, and the request parameters comprise network performance parameters. In the embodiment of the invention, the callback method for replacing the proxy object by the proxy object enables the replaced callback function to acquire the content of the network request parameter, and the default callback function set by the system can be executed after the replaced callback function is executed. The replaced callback function may collect and transmit the received network performance parameters.
The dictionary is a key value storage structure, specifically, the network request task is set as a key, and the network performance parameter is stored in the dictionary as a value. Preferably, lazy loading of the dictionary is realized when the dictionary is created.
Optionally, the method further includes acquiring an erroneous request in the network request task, removing the erroneous network request task and the corresponding network request parameter from the dictionary, and converting and uploading data in the dictionary to a server.
In the steps, the proxy object is obtained to replace the callback method, so that the network request parameter is intercepted, and the system default function is executed after the parameter is acquired, so that the interference on the normal network request can be avoided, the original code is not invaded, the method is simple and efficient, and the convenient processing of the parameter information is ensured.
Example two:
on the basis of fig. 1, taking program code as an example, details a specific implementation process of network performance parameter acquisition in conjunction with fig. 2 as follows:
NSURLSession is created in the process of initiating the network request, a request task can be generated by using NSURLSession, and the request task is called back in a proxy mode. NSURLSession is typically created by the 'session WithConfiguration: delete:' method.
In S201, a tool class DYNetworkSwizzleUtil is defined, a function hookMethod of exchanging is defined in the tool class, and exchanging of class methods is realized by runtime. And defining a function hookDelegateMethod, and realizing the replacement of the callback function through runtime.
In S202, classification of system class NSURLSession is created, switzleNetwork is defined as a method for exchanging network requests, a class method of DYNETWkSwizzleUtil is called to replace 'sessionWithConfiguration: delete' with 'dysSessionWithConfiguration: delete', and then replace 'URLSsion: task:' with DYNETWkSwizzleUtil in callback method, and 'URLSedFinisshcollectingMetrics:' and 'URLSsion: task: didComWithError:'. In the above, the replacement of the proxy object in the network request and the callback method thereof is completed.
In S202, the replacement function is extended based on nsursursion, and the replacement program can be started through S203. Specifically, a DYNETwork monitor class is defined first, and single loading is realized. Defining a class method startMonitor in the class, calling a swizzleNetwork method for NSURLSession extension in the class, and defining a dictionary performanceduc in the class for storing the collected network request parameters.
In S204, the exchanged callback method calls setMetrics, forTask and setError, withTask and method in DYNetworkmonitor respectively to transmit the acquired network request parameters.
And saving the acquired parameters to the dictionary PerformanceDic in the step S205 is realized through the step S204. Specifically, the network request task is used as a key, and the request parameter (performance parameter) is used as a value. Thus, according to the request task, the parameter information of each request can be taken. Optionally, a method setError and withTask is defined, wherein the method entry is a request error and a network request task, and is implemented by taking performance parameters keyed by the network request task from the PerformanceDic and removing the performance parameters.
Preferably, the method further comprises converting and uploading the performance parameters to a server.
Preferably, an asynchronous serial queue is created in the defined DYNetworkMonitor, all methods in the class are put into the queue, and data contention caused by operating PerformanceDic is avoided when multithreading is concurrent.
In the embodiment of the invention, the callback function in the proxy object is replaced, and after the data is intercepted, the original method is called back to execute, so that the influence on the system and the application program is reduced.
Example three:
the above mainly describes a network performance parameter acquisition method, and a detailed description will be given below of a network performance acquisition terminal device.
Fig. 3 shows a schematic structural diagram of a network performance parameter acquisition terminal device, including:
the definition module 310: a classification for defining NSURLSession, and setting an exchange method of network requests in the classification;
the classification is used for adding a new method on the basis of the original class, expanding the attribute and specifically representing a structural body pointer pointing to the classification. In the embodiment of the invention, classification of the system class NSURLSession is defined, and the function of NSURLSession can be expanded, thereby realizing a customized exchange method.
The switching module 320: when the terminal starts a predetermined application, the proxy object in NSURLSession is acquired through the classification, and a callback method in the proxy object is dynamically exchanged;
the proxy object is an instantiated network request and an object of NSURLSession from new, and the object can process network interaction tasks and information content. The callback method is a callback function executed by default of the system, and specifically comprises a method for creating NSURLSession, a call after collecting network performance parameters and a call after completing a network request
Optionally, the switching module 320 further includes:
a definition unit: the method is used for defining a tool class, and the substitution of the NSURLSession creating method and the substitution of the proxy object callback method are respectively defined in the tool class.
The tool class is mainly used for realizing the replacement of the proxy object and the replacement of the callback method, the proxy object after the replacement can acquire the original callback method and then exchange the callback method, and the exchanged callback method can transmit network request information. In the embodiment of the invention, a class method for replacing the proxy object and a class method for replacing the callback method are directly defined in the tool class, and both the two class methods are executed in a runtime function, so that dynamic exchange can be ensured, and a network request is acquired on the basis of not influencing an original code.
Optionally, the functions of the switching module 320 further include: defining a class by user, realizing the class in a singleton mode, and setting an exchange method for realizing the classification in the class.
Through the user-defined class, when the application is set and started, the exchange method in the tool class is called, and the callback function is dynamically replaced, so that the intercepted network request can be collected after the callback method is replaced, and meanwhile, other functions in the original request can be continuously executed after the callback method after the replacement is executed, so that the interference to the normal network request is avoided.
Preferably, an asynchronous serial queue is created inside the class, and all methods in the class are placed in the asynchronous serial queue.
The storage module 330: and when the network request of the predetermined application is detected, the network request is stored into a predefined dictionary through an exchanged callback method.
By the callback method for replacing the proxy object by the proxy object, the replaced callback function can acquire the content of the network request parameter, and the default callback function set by the system can be executed after the replaced callback function is executed. The replaced callback function may collect and transmit the received network performance parameters.
Optionally, the storage module 330 includes:
a setting unit: and the network request task is set as a key, and the network performance parameter is stored in the dictionary as a value.
Optionally, the storage module 330 further includes:
a removing unit: and the network request task processing module is used for acquiring the wrong request in the network request task, removing the wrong network request task and the corresponding network request parameter from the dictionary, converting the data in the dictionary and uploading the converted data to a server.
Example four:
fig. 4 is a schematic diagram of a structure of a network performance parameter acquisition terminal device according to an embodiment of the present invention. The terminal device is a mobile computer device with a touch screen, and includes but is not limited to a smart phone, a smart watch, a notebook, a tablet computer, a POS machine, and even a vehicle-mounted computer. As shown in fig. 4, the server 4 of this embodiment includes: a memory 410, a processor 420, and a system bus 430, the memory 410 including an executable program 4101 stored thereon, it being understood by those skilled in the art that the server architecture shown in FIG. 4 does not constitute a limitation of a server and may include more or fewer components than shown, or some components in combination, or a different arrangement of components.
The following specifically describes each constituent component of the terminal device with reference to fig. 4:
the memory 410 may be used to store software programs and modules, and the processor 420 performs various functional applications of the terminal and data processing by operating the software programs and modules stored in the memory 410. The memory 410 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the server, and the like. Further, the memory 410 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The executable program 4101 of the network performance parameter collection method is contained in the memory 410, and the executable program 4101 may be divided into one or more modules/units, which are stored in the memory 410 and executed by the processor 420 to complete the transmission of the notification and obtain the notification implementation process, and may be a series of computer program instruction segments capable of performing specific functions, and the instruction segments are used for describing the execution process of the computer program 4101 in the server 4. For example, the computer program 4101 may be divided into a definition module, a switching module, and a storage module.
The processor 420 is a control center of the server, connects various parts of the entire terminal device using various interfaces and lines, performs various functions of the terminal and processes data by operating or executing software programs and/or modules stored in the memory 410 and calling data stored in the memory 410, thereby integrally monitoring the terminal. Alternatively, processor 420 may include one or more processing units; preferably, the processor 420 may integrate an application processor, which mainly handles operating systems, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into processor 420.
The system bus 430 is used to connect functional units inside the computer, and can transmit data information, address information, and control information, and may be, for example, a PCI bus, an ISA bus, a VESA bus, etc. The instructions of the processor 420 are transmitted to the memory 410 through the bus, the memory 410 feeds data back to the processor 420, and the system bus 430 is responsible for data and instruction interaction between the processor 420 and the memory 410. Of course, the system bus 430 may also access other devices such as network interfaces, display devices, and the like.
The server at least includes a CPU, a chipset, a memory, a disk system, and the like, and other components are not described herein again.
In this embodiment of the present invention, the executable program executed by the processor 420 included in the server specifically includes:
a network performance parameter acquisition method comprises the following steps:
defining classification of NSURLSession, and setting an exchange method of network requests in the classification;
when the terminal starts a predetermined application, acquiring a proxy object in NSURLSession through the classification, and dynamically exchanging a callback method in the proxy object;
and when the network request of the predetermined application is detected, storing the network request into a predefined dictionary through an exchanged callback method.
Further, when the terminal starts a predetermined application, the method further includes, before the step of acquiring a proxy object in nserlession by the classification and dynamically exchanging a callback in the proxy object:
and defining a tool class, wherein a class method created by replacing the NSURLSessen and a callback method of the proxy object by a runtime function are respectively defined in the tool class.
Further, the method for acquiring the proxy object in the nsursursession through the classification and dynamically exchanging the callback in the proxy object includes:
defining a class by user, loading the class by single instance, and setting an exchange method for realizing the classification in the class.
Further, the exchange method for defining a class by user, loading the class in a single instance, and setting the class to implement the classification further includes:
and creating an asynchronous serial queue in the class, and putting all methods in the class into the asynchronous serial queue.
Further, the storing the network request into a predefined dictionary by the exchanged callback method specifically includes:
and setting the network request task as a key and storing the network performance parameter as a value in the dictionary.
Further, the setting the network request task as a key and the storing the network performance parameter as a value in the dictionary further includes:
and acquiring an error request in the network request task, removing the error network request task and the corresponding network request parameter from the dictionary, and converting and uploading data in the dictionary to a server.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (7)

1. A network performance parameter acquisition method is characterized by comprising the following steps:
defining classification of NSURLSession, and setting an exchange method of network requests in the classification of NSURLSession;
when a terminal starts a predetermined application, acquiring a proxy object in NSURLSession through the classification of NSURLSession, and dynamically exchanging a callback method in the proxy object, wherein the callback method is a method for creating NSURLSession;
when the network request of the predetermined application is detected, storing the network request into a predefined dictionary through an exchanged callback method;
when the terminal starts a predetermined application, the method further includes, before the step of obtaining the proxy object in the NSURLSession by the classification of the NSURLSession and dynamically exchanging the callback in the proxy object:
defining a tool class, and respectively defining the replacement of the NSURLSession establishing method and the replacement of the proxy object callback method in the tool class; when the replacing is successful, the exchange method returns a Boolean type value, and if the replacing is not completed, a corresponding callback function is preset and is injected into the proxy object;
the method for acquiring the proxy object in NSURLSessions through the classification of NSURLSessions and dynamically exchanging the call-back in the proxy object comprises the following steps:
defining a class by user, realizing the class in a singleton mode, and setting an exchange method for realizing the NSURLSession classification in the class.
2. The method of claim 1, wherein the defining a class and implementing the class in singleton mode, and the switching method for implementing the classification within the class is further configured to:
and creating an asynchronous serial queue in the class, and putting all methods in the class into the asynchronous serial queue.
3. The method according to claim 1, wherein said storing of said network request into a predefined dictionary by means of exchanged callback methods is specifically:
and setting the network request task as a key and storing the network performance parameter as a value into the dictionary.
4. The method of claim 3, wherein said setting said network request task as a key and storing network performance parameters as values in said dictionary further comprises:
and acquiring an error request in the network request task, removing the error network request task and the corresponding network request parameter from the dictionary, converting the network request data stored in the dictionary, and uploading the converted network request data to a server.
5. A network performance parameter acquisition terminal device is characterized by comprising:
a definition module: the method comprises the steps of defining the classification of NSURLSession, and setting an exchange method of network requests in the classification of NSURLSession;
a switching module: when a terminal starts a predetermined application, acquiring a proxy object in NSURLSession through the classification of NSURLSession, and dynamically exchanging a callback method in the proxy object, wherein the callback method is a method for creating NSURLSession; wherein the switching module further comprises: defining a class by self, realizing the class in a singleton mode, and setting an exchange method for realizing the classification of NSURLSession in the class;
a storage module: when the network request of the predetermined application is detected, the network request is stored into a predefined dictionary through an exchanged callback method;
the switching module includes:
a definition unit: the system is used for defining a tool class, and respectively defining the replacement of the NSURLSession establishing method and the replacement of the proxy object callback method in the tool class; and when the replacing is successful, the exchange method returns a Boolean type value, and if the replacing is not completed, the corresponding callback function is preset and is injected into the proxy object.
6. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the network performance parameter acquisition method according to any one of claims 1 to 4 when executing the computer program.
7. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the steps of the network performance parameter acquisition method according to any one of claims 1 to 4.
CN201810611644.2A 2018-06-14 2018-06-14 Network performance parameter acquisition method, terminal device and storage medium Active CN108809763B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810611644.2A CN108809763B (en) 2018-06-14 2018-06-14 Network performance parameter acquisition method, terminal device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810611644.2A CN108809763B (en) 2018-06-14 2018-06-14 Network performance parameter acquisition method, terminal device and storage medium

Publications (2)

Publication Number Publication Date
CN108809763A CN108809763A (en) 2018-11-13
CN108809763B true CN108809763B (en) 2022-03-25

Family

ID=64086115

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810611644.2A Active CN108809763B (en) 2018-06-14 2018-06-14 Network performance parameter acquisition method, terminal device and storage medium

Country Status (1)

Country Link
CN (1) CN108809763B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110290204B (en) * 2019-06-25 2022-05-17 腾讯科技(深圳)有限公司 Browser over-proxy implementation method and device and terminal equipment

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8271602B2 (en) * 2006-01-11 2012-09-18 Oracle International Corporation System and method for conversation based on web service addressing
US9219774B2 (en) * 2009-11-16 2015-12-22 Sap Se Exchange of callback information
CN103944906B (en) * 2014-04-25 2017-03-15 厦门享游网络科技有限公司 A kind of method guided for the HTTP flows of APP on iOS
US10581987B2 (en) * 2015-07-06 2020-03-03 Airwatch Llc Application network usage management
CN105426310B (en) * 2015-11-27 2018-06-26 北京奇虎科技有限公司 A kind of method and apparatus for the performance for detecting target process
CN107436832B (en) * 2016-05-27 2020-11-27 阿里巴巴集团控股有限公司 Dynamic point burying method and device and electronic equipment
CN107071017B (en) * 2017-03-31 2020-06-16 武汉斗鱼网络科技有限公司 Network request agent tool and agent method for android system
CN107729452B (en) * 2017-10-09 2020-07-10 武汉斗鱼网络科技有限公司 Webpage loading method and device, electronic equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN108809763A (en) 2018-11-13

Similar Documents

Publication Publication Date Title
EP3355187A1 (en) Loading method and device for terminal application (app)
CN109344066B (en) Method, system and terminal for testing browser page
CN110933075B (en) Service calling method and device, electronic equipment and storage medium
CN110716848A (en) Data collection method and device, electronic equipment and storage medium
CN108900627B (en) Network request method, terminal device and storage medium
US10223407B2 (en) Asynchronous processing time metrics
CN108809763B (en) Network performance parameter acquisition method, terminal device and storage medium
CN113885971A (en) State management method and device based on self-adaptive platform system
CN108062401B (en) Application recommendation method and device and storage medium
CN111294377B (en) Dependency network request sending method, terminal device and storage medium
CN111376255B (en) Robot data acquisition method and device and terminal equipment
CN113721936B (en) Application management method, intelligent terminal, device and storage medium
CN111506499B (en) Method and device for detecting availability of parameters in applet and electronic equipment
CN109150993B (en) Method for obtaining network request tangent plane, terminal device and storage medium
CN111090627B (en) Log storage method and device based on pooling, computer equipment and storage medium
CN112463626A (en) Memory leak positioning method and device, computer equipment and storage medium
CN110825477A (en) Method, device and equipment for loading graphical interface and storage medium
CN116225576B (en) Application program data environment switching method and device, electronic equipment and medium
CN111124907A (en) Mobile phone game testing method and device and server
CN110716908A (en) Log information writing method, system, storage medium and mobile terminal
CN111930391A (en) Application data processing method and device, server and user terminal
CN113268300B (en) Information display method and device
CN115657625B (en) Monitoring method, program product, system, device and readable storage medium
CN113111012B (en) Application data locator generation method and application data locating method
CN113836405B (en) Information query method, device 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
GR01 Patent grant
GR01 Patent grant