CN114327738B - Refreshing method and device of user interface, electronic equipment and readable storage medium - Google Patents

Refreshing method and device of user interface, electronic equipment and readable storage medium Download PDF

Info

Publication number
CN114327738B
CN114327738B CN202210244141.2A CN202210244141A CN114327738B CN 114327738 B CN114327738 B CN 114327738B CN 202210244141 A CN202210244141 A CN 202210244141A CN 114327738 B CN114327738 B CN 114327738B
Authority
CN
China
Prior art keywords
refreshing
interface
time
processor
current
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
CN202210244141.2A
Other languages
Chinese (zh)
Other versions
CN114327738A (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.)
Hundsun Technologies Inc
Original Assignee
Hundsun Technologies Inc
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 Hundsun Technologies Inc filed Critical Hundsun Technologies Inc
Priority to CN202210244141.2A priority Critical patent/CN114327738B/en
Publication of CN114327738A publication Critical patent/CN114327738A/en
Application granted granted Critical
Publication of CN114327738B publication Critical patent/CN114327738B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Read Only Memory (AREA)

Abstract

The embodiment of the invention provides a method and a device for refreshing a user interface, electronic equipment and a readable storage medium, wherein the method comprises the following steps: acquiring the current load of a processor, historical time information of last interface refreshing and current time information; determining whether to refresh the interface according to the current load of the processor, the historical time information of the last interface refresh and the current time information; if yes, obtaining data to be refreshed, and refreshing the user interface according to the data to be refreshed. In the interface refreshing process, the interface refreshing method and the device not only consider the hardware condition of the device, namely the load of the processor, and avoid the problem of interface refreshing jamming caused by overhigh load in the interface refreshing process, but also perform interface refreshing when the refreshing is determined to be needed instead of performing interface refreshing as soon as the data to be refreshed exists, so that the data can be timely updated to the interface, and the timeliness is ensured.

Description

Refreshing method and device of user interface, electronic equipment and readable storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a method and a device for refreshing a user interface, electronic equipment and a readable storage medium.
Background
With the development of internet technology, the business of the internet is continuously increased, and users can obtain various services such as financial services and shopping services by using different business systems, so that the use experience of the internet is greatly improved.
In order to obtain the service execution condition in time, a user can subscribe a message center of the service system through the terminal, when the data state of the service system changes, the service system immediately notifies the terminal, and the terminal can refresh an interface after receiving the notification.
However, in a high-frequency message scene, the terminal is prone to have a problem of message backlog, and further blocks user operation, so that the terminal is in a non-response state.
Disclosure of Invention
An objective of the present invention is to provide a method and an apparatus for refreshing a user interface, an electronic device, and a readable storage medium, so as to solve the above technical problems.
Embodiments of the invention may be implemented as follows:
in a first aspect, the present invention provides a method for refreshing a user interface, the method comprising: acquiring the current load of a processor, historical time information of last interface refreshing and current time information; determining whether to refresh the interface according to the current load of the processor, the historical time information of the last interface refresh and the current time information; if so, acquiring data to be refreshed, and refreshing the user interface according to the data to be refreshed.
In a second aspect, the present invention provides a device for refreshing a user interface, including: the acquisition module is used for acquiring the current load of the processor, the historical time information of the last interface refreshing and the current time information; the determining module is used for determining whether to refresh the interface according to the current load of the processor, the historical time information of the last interface refresh and the current time information; and the refreshing module is used for acquiring the data to be refreshed if the data to be refreshed exists, and refreshing the user interface according to the data to be refreshed.
In a third aspect, the invention provides an electronic device comprising a processor and a memory, the memory storing a computer program executable by the processor, the processor being capable of executing the computer program to implement the method of the first aspect.
In a fourth aspect, the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of the first aspect.
The invention provides a method and a device for refreshing a user interface, electronic equipment and a readable storage medium, which are characterized in that firstly, the current load of a processor, the historical time information of the last interface refreshing and the current time information are obtained; determining whether to refresh the interface according to the current load of the processor, the historical time information of the last interface refresh and the current time information; if yes, obtaining data to be refreshed, and refreshing the user interface according to the data to be refreshed. In the interface refreshing process, the embodiment of the invention not only considers the hardware condition of the equipment, namely the load of the processor, and avoids interface refreshing pause caused by overhigh load in the interface refreshing process, but also refreshes the interface only when the interface needs to be refreshed instead of refreshing the interface with data to be refreshed, thereby timely updating the data to the interface and ensuring timeliness.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is an application scene diagram of a method for refreshing a user interface according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present invention;
FIG. 3 is a schematic flow chart of a refreshing method of a user interface according to an embodiment of the present invention;
fig. 4 is a schematic flowchart of step S302 provided in the embodiment of the present invention;
FIG. 5 is a schematic flow chart of step S302-2 provided by the embodiment of the present invention;
fig. 6 is a functional block diagram of a refreshing apparatus of a user interface according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. 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.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present invention, it should be noted that if the terms "upper", "lower", "inside", "outside", etc. indicate an orientation or a positional relationship based on that shown in the drawings or that the product of the present invention is used as it is, this is only for convenience of description and simplification of the description, and it does not indicate or imply that the device or the element referred to must have a specific orientation, be constructed in a specific orientation, and be operated, and thus should not be construed as limiting the present invention.
Furthermore, the appearances of the terms "first," "second," and the like, if any, are used solely to distinguish one from another and are not to be construed as indicating or implying relative importance.
It should be noted that the features of the embodiments of the present invention may be combined with each other without conflict.
As shown in fig. 1, fig. 1 is an application scenario diagram of a method for refreshing a user interface according to an embodiment of the present invention, where the application scenario diagram includes a terminal 102, a network 104, and a server 106.
The terminal 102 may be, but is not limited to, a Personal Computer (PC), such as a desktop, a one-piece Computer, a notebook Computer, a tablet Computer, and the like, the terminal 102 may have applications related to the service installed therein, and the server 106 may be, but is not limited to, a server or a server cluster.
The server 106 may provide various services for the terminal 102, for example, a financial service, a shopping service, and the like, and a user may subscribe to a data monitoring message of the server 106 through the terminal 102, and if a background data state changes, the server 106 sends the message to the terminal 102. After receiving the message, the terminal 102 packages the message into a user interface update event, and further refreshes the user interface, so that the user can know the service progress conveniently.
For example, taking financial services as an example, a user may send an order data to the server 106 through the terminal 102, and the server 106 generates a data state change message for each processing node in a process of processing the order data, for example, when the order data is currently located in a counter processing node, the server 106 sends the state data to the terminal 102, and after the terminal 102 performs interface refreshing, the user can visually see the node where the order is located on the user interface, so that the user can visually grasp the order direction.
In order to refresh the user interface in time, the message cyclic scheduling mechanism of the terminal 102 may sequentially obtain messages from the message queue, obtain data to be displayed on the user interface, and further perform interface refresh according to the corresponding interface update operation. However, at present, the operation of the terminal 102 for updating the interface does not consider the hardware condition limitation of the terminal 102, for example, if the terminal 102 performs interface refreshing every time it receives a message, the current load of the processor is not considered, and if the server 106 frequently sends a message of changing the data state to the terminal 102, the terminal 102 may accumulate a large amount of messages in a short time and cannot process the messages in time, thereby blocking the user operation and causing the terminal to be in a non-response state.
Therefore, the related art provides a user interface refreshing method, which includes the following steps:
s1, setting a trigger, setting the trigger to a fixed trigger time interval, and the trigger callback function of the trigger comprises user interface updating operation;
and S2, if the trigger time interval is reached, executing the user interface updating operation in the trigger callback function of the trigger.
And S3, repeating the operation of S2 until no interface updating requirement exists.
Through careful analysis and research, the user interface refreshing mode provided by the method has the following defects:
a. the trigger time interval is determined when the trigger is defined, and cannot be modified at run-time, so that the flexibility is insufficient.
b. If the trigger time interval is set to be too small, under the condition that the processor load is high, the callback function of the trigger still has the situation that the processing of the message is not time to process, and the message backlog is still caused, so that the interface card is not responded.
c. If the trigger time interval is set too large, the user interface cannot be updated in time, and the timeliness of data is damaged.
d. It is not possible to determine whether a user interface update is required, resulting in a user interface update message being sent each polling.
In order to solve the technical defect, an embodiment of the present invention provides a method for refreshing a user interface, which can implement automatic frequency control on the trigger of a terminal on a user interface update event in a high-frequency message scene, and avoid no response of a program due to message queue blocking.
Referring first to fig. 2, fig. 2 is a schematic structural diagram of an electronic device according to an embodiment of the present invention, and it can be understood that the electronic device may be used to execute a method for refreshing a user interface according to the embodiment of the present invention, for example, the electronic device may be the terminal 102 in fig. 1.
As shown in fig. 2, the electronic device 200 comprises a memory 201, a processor 202 and a communication interface 203, wherein the memory 201, the processor 202 and the communication interface 203 are electrically connected directly or indirectly to each other to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The memory 201 may be used to store software programs and modules, such as program instructions/modules corresponding to the refresh apparatus 400 for providing a user interface according to an embodiment of the present invention, and may be stored in the memory 201 in the form of software or firmware or may be fixed in an Operating System (OS) of the electronic device 200, and the processor 202 executes the software programs and modules stored in the memory 201, so as to perform various functional applications and data processing. The communication interface 203 may be used for communication of signaling or data with other node devices.
The Memory 201 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read Only Memory (PROM), an Erasable Read Only Memory (EPROM), an electrically Erasable Read Only Memory (EEPROM), and the like.
Processor 202 may be an integrated circuit chip having signal processing capabilities. The processor 202 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
It will be appreciated that the configuration shown in FIG. 2 is merely illustrative and that electronic device 200 may include more or fewer components than shown in FIG. 2 or may have a different configuration than shown in FIG. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
Referring to fig. 3, fig. 3 is a schematic flowchart of a method for refreshing a user interface according to an embodiment of the present invention, where the method for writing a file according to an embodiment of the present invention is described as an example when the electronic device 200 executes the method according to an embodiment of the present invention, and the method may include:
s301, obtaining the current load of the processor, the historical time information of the last interface refreshing and the current time information.
S302, whether the interface is refreshed or not is determined according to the current load of the processor, the historical time information of the last interface refreshing and the current time information.
And S303, if so, acquiring data to be refreshed, and refreshing the user interface according to the data to be refreshed.
According to the method for refreshing the user interface provided by the embodiment of the invention, the current load of the processor, the historical time information of the last interface refreshing and the current time information are firstly obtained, then whether the interface refreshing is carried out or not is determined according to the current load of the processor, the historical time information of the last interface refreshing and the current time information, the data to be refreshed is obtained when the interface refreshing is determined to be required, and the user interface is refreshed according to the data to be refreshed, in the interface refreshing process, the hardware condition of the equipment, namely the load of the processor is considered, the interface refreshing blockage caused by overhigh load in the interface refreshing process is avoided, in addition, the interface refreshing is not carried out when the data to be refreshed is available, but the interface refreshing is determined to be required, the data can be updated to the interface in time, and the timeliness is guaranteed.
The above steps S301 to S303 will be described in detail with reference to the drawings and specific embodiments.
In step S301, the current load of the processor, the historical time information of the last interface refresh, and the current time information are first obtained.
In the embodiment of the present invention, the current load of the processor may be directly obtained from the electronic device, for example, the electronic device may monitor the load condition of the processor in real time, or the electronic device reads the load from the hardware operating data.
It can be considered that if the current load is higher, the interface refreshing is performed, and the situation of occupied processor resources inevitably occurs, so that the system cannot respond.
In step S302, it is determined whether to perform interface refresh according to the current load of the processor, the historical time information of the last interface refresh, and the current time information.
In the embodiment of the present invention, the historical time information of the last interface refresh may include, but is not limited to, a time consumed by the last interface refresh and a timestamp for ending the last interface refresh, and these historical time information may reflect the strength of the interface processing capability of the processor, and are used to determine the interface refresh timing to avoid deadlock. The current time information may include, but is not limited to, current system time and time information of a currently received message, and the current refresh time is determined by combining historical time information of last interface refresh and current time information, that is, a time interval between the current refresh and the last refresh may be determined, so that data may be updated to the interface in time, timeliness is guaranteed, batch processing of the message may be performed, and load of the processor may be reduced.
In a possible implementation, in order to obtain historical time information quickly. After each interface refreshing, the historical time information may be stored, for example, the time consumed by the last interface refreshing and the timestamp for ending the last interface refreshing are separately stored in a storage area, and after each interface refreshing is ended, the historical time information in the storage area is updated, so that the historical time information may be quickly obtained at the next updating.
In a possible implementation manner, an implementation manner of the step S302 may be as shown in fig. 4, where fig. 4 is a schematic flowchart of the step S302 according to an embodiment of the present invention:
s302-1, obtaining historical refreshing time consumption and a historical refreshing time stamp in the historical time information of the last interface refreshing, and obtaining a current system time stamp in the current time information and a time stamp of the last received data state change message.
S302-2, determining a first threshold according to the current load of the processor and the historical refreshing time consumption.
S302-3, if the time difference between the current system timestamp and the historical refreshing timestamp is larger than a first threshold value, determining to update an interface;
s302-4, if the time difference between the current system timestamp and the timestamp of the last received data state change message is larger than a preset second threshold value, determining to perform interface refreshing.
In the embodiment of the invention, the first threshold is a threshold used for determining the interface updating time, and is determined according to the current load of the processor and the historical refreshing time consumption, so that the load capacity of the processor can be reflected, the worse the processor is, the worse the load capacity in the updating process is, the larger the first threshold is, the better the processor is, the better the load capacity in the updating process is, the smaller the first threshold is, the time interval of interface updating is dynamically adjusted through the first threshold, the hardware performance is fully utilized, and the interface updating time can be prevented from being blocked.
It can be understood that if the time difference between the current system timestamp and the historical refresh timestamp is less than or equal to the first threshold, it is determined that the interface is updated, and the time difference between the current system timestamp and the timestamp of the last received data state change message is less than or equal to the preset second threshold, it is determined that the interface is not refreshed.
In a possible implementation manner, an implementation manner of the step S302-2 may be as shown in fig. 5, where fig. 5 is a schematic flowchart of the step S302-2 provided in an embodiment of the present invention:
s302-2-1, matching the current load of the processor with a plurality of preset load ranges, and acquiring the processor weight corresponding to the successfully matched load range;
S302-2-2, matching the historical refreshing time consumption with a plurality of preset refreshing time consumption ranges, and acquiring refreshing time consumption weights corresponding to the successfully matched refreshing time consumption ranges;
s302-2-3, determining a first threshold value according to the processor weight, the refresh time consumption weight and the historical refresh time consumption.
In the embodiment of the present invention, the preset multiple load ranges, multiple refresh time consumption ranges, and the processor weight and refresh time consumption weight may be as shown in table 1.
TABLE 1
Range of load 0~20% 20%~40% 40%~60% Over 60 percent
Processor weights
1 1.2 1.5 2
Refreshing a time-consuming Range <100ms 100~500ms 500~1000ms More than 1000ms
Refreshing time-consuming weights 1 1.2 1.5 2
In conjunction with Table 1, then the first threshold value in step S302-2-3 may be determined in the form of: first threshold = processor weight refresh elapsed time weight last interface refresh elapsed time.
For example, assuming that the current load of the processor is 54%, the last interface refresh time is 134ms, 54% is matched with the plurality of load ranges in table 1, that is, 54% is located in which load range, 54% is located between 40% and 60%, the processor weight corresponding to 40% to 60% is 1.5, 134ms is matched with the plurality of refresh time ranges in table 1, that is, 134ms is located in which refresh time range, and 134ms is located between 100 ms and 500ms, the refresh time weight corresponding to 100 ms to 500ms is 1.2, so that the second threshold is 1.5 × 1.2 × 134=241.2ms, that is, if the time difference between the current system timestamp and the timestamp of the last received data state change message is greater than 241.2ms, the interface refresh is started, and the interface refresh is not performed in the process less than or equal to 241.2ms, batch messages can be processed in this process.
In the embodiment of the present invention, the second threshold may be self-defined according to the message characteristics, and it can be understood that, the number and time of messages sent to the terminal by the service system are uncertain, and it is possible to send batch messages at a time, or send a single message at a time, for both cases, if the interface refreshing is performed while waiting for the same duration (for example, waiting for 5 seconds), the effect is not good and the timeliness of the messages is affected, then the second threshold may know that no message is pushed in a short time, immediately update the interface, and if a large batch of messages come, update the interface when the interface refreshing is determined, and update the data to the interface in time, thereby ensuring timeliness, and also performing batch processing of the messages.
It can be understood that, in the embodiment of the present invention, the time interval between the current refresh and the last refresh can be dynamically adjusted through the first threshold, thereby avoiding the situation that the load of the processor is high for a long time and affecting the refresh efficiency, and meanwhile, the refresh time interval of different types and different numbers of message times can be dynamically adjusted through the second threshold, thereby realizing batch message processing and simultaneously ensuring timeliness.
In step S303, if yes, the data to be refreshed is obtained, and the user interface is refreshed according to the data to be refreshed.
In the embodiment of the invention, the data to be refreshed is information which needs to be displayed on a user interface, so that a user can intuitively master the business trend.
It can be understood that the data to be refreshed is extracted from the data state change message, where the data state change message is a message generated when the business system monitors that the business state changes, for example, taking a financial business as an example, the business system may generate the data state change message after monitoring that a processing node of an order changes, that is, before obtaining the data to be refreshed, the data state change message may be received first, and then the data to be refreshed is extracted from the data state change message, and the data to be refreshed is cached.
In order to quickly obtain the data to be refreshed, all the data to be refreshed can be stored in a storage area in a stacking mode, and it can be understood that a service system can push batch messages to a terminal at one time, so that a plurality of data to be refreshed can be obtained.
It can be understood that if the interface is currently refreshed, which means that the risk of interface jamming is low, the user interface can be refreshed according to the awakened interface refresh thread, so that the data to be refreshed is directly displayed on the user interface.
In a possible implementation, step S303 may be performed by: and packaging the data to be refreshed into a user interface refreshing message, refreshing the user interface according to the user interface refreshing message, and facilitating the user to timely and intuitively know the service dynamic.
Optionally, in order to reduce invalid update and reduce resource occupation on the processor, a possible implementation manner is further provided in the embodiment of the present invention, that is, the embodiment of the present invention may further include the following steps:
when the data to be refreshed does not exist, controlling the interface updating thread to be in a dormant state, and reducing the load value of the processor until the data to be refreshed exists, and controlling the interface updating thread to run; or,
and when the interface refreshing is determined not to be carried out, controlling the interface updating thread to be in a dormant state, and reducing the load value of the processor until the dormant time of the interface updating thread reaches the preset time, and controlling the interface updating thread to run.
The preset time may be 5ms, or may be self-defined according to an actual situation, which is not limited herein. That is to say, when there is no data to be refreshed or when the interface is not refreshed currently, the interface updating thread may be controlled to sleep, thereby achieving the effect of reducing the resource occupation of the processor.
Optionally, in order to quickly determine the second threshold used for determining the update time when the interface is updated next time, the embodiment of the present invention further provides a possible implementation manner, that is, after step S303, the embodiment of the present invention may further include the following steps:
b1, acquiring the current refreshing time of the user interface and the current time stamp when the refreshing is completed;
b2, according to the current refresh time and the current time stamp when the refresh is finished, updating the historical time information of the last interface refresh.
By the embodiment, the time information of the current interface refreshing can be stored in time, and the time information can be quickly obtained to determine the second threshold when the interface is updated next time, so that the processing efficiency is improved.
It can be seen from the above embodiments that, after the user interface refreshing method provided by the embodiments of the present invention obtains the data to be refreshed, interface refreshing is not performed immediately, but whether interface refreshing is performed currently can be determined according to the historical refreshing time information, the current time information, and the load condition of the processor, so that the data to be refreshed can be processed in batch, the timeliness is also taken into consideration, and the blocking caused by frequent updating of the interface is avoided.
In order to more simply understand the implementation process of the above method for refreshing a user interface, the embodiment of the present invention is explained by taking fig. 1 as an example, and in a process of refreshing an interface, the above method for refreshing a user interface may be implemented as follows:
s1, the server 106 sends a data state change message to the terminal 102.
S2, the terminal 102 caches the data to be refreshed, which need to be displayed on the user interface, in the data state change message in a first storage area, and caches the timestamp of the last data state change message in a second storage area.
S4, the terminal 102 awakens an interface updating and refreshing thread: determining whether data to be refreshed exists in the first storage area; if not, executing S5; if so, S6 is executed.
S5, the terminal 102 controls the interface updating thread to be in a dormant state, and S6 is executed until the data to be refreshed exist.
S6, the terminal 102 determines that the time difference between the current system timestamp and the historical refreshing timestamp is larger than a first threshold value, or determines that the time difference between the current system timestamp and the timestamp of the last received data state change message is larger than a preset second threshold value; if not, go to S7; if so, go to S8;
s7, the terminal 102 controls the interface updating thread to be in a dormant state until the dormant time of the interface updating thread reaches a preset time, and controls the interface updating thread to run;
S8, the terminal 102 obtains the data to be refreshed in the first storage area and packages the data to be refreshed into a user interface updating message.
And S9, the terminal 102 sends a user interface updating message, triggers the user interface to be refreshed, obtains the current refreshing time consumption of the user interface and the current timestamp when refreshing is completed, and stores the current refreshing time consumption and the current timestamp when refreshing is completed in a third storage area.
S10, the terminal 102 enters the next execution cycle.
The whole process can know whether the user interface needs to be updated or not, avoids sending invalid user interface updating information, can realize batch information processing in a high-frequency information scene, improves the information processing efficiency, avoids contention on processor resources, and reduces the instantaneous load of the processor.
In order to implement the steps in the foregoing embodiments to achieve corresponding technical effects, the method for refreshing a user interface provided in the embodiments of the present invention may be implemented in a hardware device or in a software module, and when the method for refreshing a user interface is implemented in a software module, an embodiment of the present invention further provides a device for refreshing a user interface, please refer to fig. 6, where fig. 6 is a functional block diagram of the device for refreshing a user interface provided in the embodiments of the present invention, and the device 400 for refreshing a user interface may include:
The obtaining module 410 is configured to obtain a current load of the processor, historical time information of a last interface refresh, and current time information.
A determining module 420, configured to determine whether to perform interface refreshing according to a current load of the processor, historical time information of a last interface refreshing, and current time information;
and the refreshing module 430 is configured to, if yes, obtain data to be refreshed, and refresh the user interface according to the data to be refreshed.
In an optional embodiment, the determining module 420 is specifically configured to obtain historical refresh time and a historical refresh timestamp in historical time information of a last interface refresh, and a current system timestamp and a timestamp of a last received data state change message in current time information; determining a first threshold value according to the current load of the processor and the historical refreshing time consumption; if the time difference between the current system timestamp and the historical refreshing timestamp is larger than a first threshold value, determining to update the interface; or if the time difference between the current system timestamp and the timestamp of the last received data state change message is greater than a preset second threshold, determining to perform interface refreshing.
In an optional embodiment, the determining module 420 is further specifically configured to match the current load of the processor with a plurality of preset load ranges, and obtain a processor weight corresponding to a load range successfully matched; matching the historical refreshing time consumption with a plurality of preset refreshing time consumption ranges, and acquiring refreshing time consumption weights corresponding to the successfully matched refreshing time consumption ranges; and determining a first threshold value according to the processor weight, the refresh time consumption weight and the historical refresh time consumption.
In an optional embodiment, the system may further include a storage module, configured to obtain a current refresh time of the user interface and a current timestamp when the refresh is completed; and updating the historical time information of the last interface refreshing according to the current refreshing time and the current timestamp when the refreshing is finished.
In an optional embodiment, the apparatus may further include a control module, configured to control the interface update thread to be in a sleep state when it is determined that the data to be refreshed does not exist, and control the interface update thread to run until the data to be refreshed exists; or when the interface is determined not to be refreshed, controlling the interface updating thread to be in a dormant state, and controlling the interface updating thread to run until the dormant time of the interface updating thread reaches the preset time.
In an alternative embodiment, the refresh module 430 is specifically configured to encapsulate data to be refreshed into a user interface refresh message; and refreshing the user interface according to the user interface refreshing message.
In an optional embodiment, the system may further include an extraction module, configured to receive a data state change message; and extracting the data to be refreshed from the data state change message, and caching the data to be refreshed.
An embodiment of the present invention further provides a readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the method for refreshing a user interface according to any one of the foregoing embodiments. The computer readable storage medium may be, but is not limited to, various media that can store program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a PROM, an EPROM, an EEPROM, a magnetic or optical disk, etc.
It should be understood that the disclosed apparatus and method may be embodied in other forms. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, the functional modules in the embodiments of the present invention may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on such understanding, the technical solution of the present invention or a part thereof which substantially contributes to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk, and various media capable of storing program codes. It should be noted that, in this document, relational terms such as first and second, and the like are used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
The present invention has been described in terms of the preferred embodiment, and it is not intended to be limited to the embodiment. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.

Claims (10)

1. A method for refreshing a user interface, the method comprising:
acquiring the current load of a processor, historical time information of last interface refreshing and current time information;
determining whether to refresh the interface according to the current load of the processor, the historical time information of the last interface refresh, the current time information, the first threshold and the second threshold; the first threshold value is determined according to the current load and the historical refresh time of the processor; the first threshold is used for adjusting the time interval between the current refreshing and the last refreshing; the second threshold is used for adjusting refresh time intervals of different types and different numbers of message time;
If yes, obtaining data to be refreshed, and refreshing the user interface according to the data to be refreshed.
2. The method of claim 1, wherein determining whether to perform an interface refresh based on a current load of a processor, historical time information of a last interface refresh, and current time information, a first threshold, and a second threshold comprises:
obtaining historical refreshing time consumption and a historical refreshing time stamp in historical time information of last interface refreshing, and a current system time stamp and a time stamp of a last received data state change message in the current time information;
determining the first threshold according to the current load of the processor and the historical refresh time;
if the time difference between the current system timestamp and the historical refreshing timestamp is larger than the first threshold, determining to update an interface; or,
and if the time difference between the current system time stamp and the time stamp of the last received data state change message is greater than the second threshold value, determining to refresh the interface.
3. The method of claim 2, wherein the first threshold is determined based on a current load of the processor and the historical refresh time, the method further comprising:
Matching the current load of the processor with a plurality of preset load ranges, and acquiring the processor weight corresponding to the successfully matched load range;
matching the historical refreshing time consumption with a plurality of preset refreshing time consumption ranges, and acquiring refreshing time consumption weights corresponding to the successfully matched refreshing time consumption ranges;
and determining the first threshold according to the processor weight, the refresh time consumption weight and the historical refresh time consumption.
4. The method according to claim 1, wherein after acquiring the data to be refreshed and refreshing the user interface according to the data to be refreshed, the method further comprises:
obtaining the current refreshing time consumption of the user interface and the current timestamp when refreshing is completed;
and updating the historical time information of the last interface refreshing according to the current refreshing time and the current timestamp when the refreshing is completed.
5. The method of claim 1, further comprising:
when the data to be refreshed does not exist, controlling an interface updating thread to be in a dormant state until the data to be refreshed exists, and controlling the interface updating thread to run; or,
And when determining that the interface is not refreshed, controlling the interface updating thread to be in a dormant state until the dormant time of the interface updating thread reaches a preset time, and controlling the interface updating thread to run.
6. The method of claim 1, wherein if yes, obtaining data to be refreshed, and refreshing a user interface according to the data to be refreshed comprises:
packaging the data to be refreshed into a user interface refreshing message;
and refreshing the user interface according to the user interface refreshing message.
7. The method of claim 1, wherein prior to obtaining a current load of the processor, historical time information of a last interface refresh, and current time information, the method further comprises:
receiving a data state change message;
and extracting the data to be refreshed from the data state change message, and caching the data to be refreshed.
8. An apparatus for refreshing a user interface, comprising:
the acquisition module is used for acquiring the current load of the processor, the historical time information of the last interface refreshing and the current time information; the determining module is used for determining whether to refresh the interface according to the current load of the processor, the historical time information of the last interface refreshing, the current time information, the first threshold and the second threshold; the first threshold value is determined according to the current load and the historical refresh time of the processor; the first threshold is used for adjusting the time interval between the current refreshing and the last refreshing; the second threshold is used for adjusting refresh time intervals of different types and different numbers of message time;
And the refreshing module is used for acquiring the data to be refreshed if the data to be refreshed exists, and refreshing the user interface according to the data to be refreshed.
9. An electronic device comprising a processor and a memory, the memory storing a computer program executable by the processor, the processor being operable to execute the computer program to implement the method of any one of claims 1 to 7.
10. A readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-7.
CN202210244141.2A 2022-03-14 2022-03-14 Refreshing method and device of user interface, electronic equipment and readable storage medium Active CN114327738B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210244141.2A CN114327738B (en) 2022-03-14 2022-03-14 Refreshing method and device of user interface, electronic equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210244141.2A CN114327738B (en) 2022-03-14 2022-03-14 Refreshing method and device of user interface, electronic equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN114327738A CN114327738A (en) 2022-04-12
CN114327738B true CN114327738B (en) 2022-06-14

Family

ID=81034012

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210244141.2A Active CN114327738B (en) 2022-03-14 2022-03-14 Refreshing method and device of user interface, electronic equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN114327738B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115525667A (en) * 2022-10-12 2022-12-27 赫中企云(北京)信息服务有限公司 Rule hot updating method during program operation

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103825922A (en) * 2012-11-19 2014-05-28 华为技术有限公司 Data updating method and web server
WO2014201882A1 (en) * 2013-06-18 2014-12-24 苏州阔地网络科技有限公司 Web page visiting control method and system
CN106201549A (en) * 2016-07-22 2016-12-07 北京金山安全软件有限公司 Control method and device for information in application program and terminal equipment
CN108170500A (en) * 2017-11-28 2018-06-15 深圳市金立通信设备有限公司 Download progress method for refreshing, terminal device and computer readable storage medium
CN113190777A (en) * 2021-03-31 2021-07-30 北京达佳互联信息技术有限公司 Data updating method and device, electronic equipment, storage medium and product
CN113805983A (en) * 2020-09-08 2021-12-17 荣耀终端有限公司 Method for adjusting window refresh rate and electronic equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11093518B1 (en) * 2017-09-23 2021-08-17 Splunk Inc. Information technology networked entity monitoring with dynamic metric and threshold selection
CN113132526B (en) * 2019-12-31 2022-07-22 华为技术有限公司 Page drawing method and related device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103825922A (en) * 2012-11-19 2014-05-28 华为技术有限公司 Data updating method and web server
WO2014201882A1 (en) * 2013-06-18 2014-12-24 苏州阔地网络科技有限公司 Web page visiting control method and system
CN106201549A (en) * 2016-07-22 2016-12-07 北京金山安全软件有限公司 Control method and device for information in application program and terminal equipment
CN108170500A (en) * 2017-11-28 2018-06-15 深圳市金立通信设备有限公司 Download progress method for refreshing, terminal device and computer readable storage medium
CN113805983A (en) * 2020-09-08 2021-12-17 荣耀终端有限公司 Method for adjusting window refresh rate and electronic equipment
CN113190777A (en) * 2021-03-31 2021-07-30 北京达佳互联信息技术有限公司 Data updating method and device, electronic equipment, storage medium and product

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Optical Flow Switching with Time Deadlines for High-Performance Applications;Vincent W. S. Chan;《IEEE》;20091231;全文 *
调度图形混合数据刷新模式研究;张志学;《电工技术》;20170731;全文 *

Also Published As

Publication number Publication date
CN114327738A (en) 2022-04-12

Similar Documents

Publication Publication Date Title
CN107111632B (en) Method and system for regulating communications at a mobile communication device
CN105208125B (en) message transmission method, device and system
CN111163159B (en) Message subscription method, device, server and computer readable storage medium
CN109800204B (en) Data distribution method and related product
CN109117280B (en) Electronic device, method for limiting inter-process communication thereof and storage medium
EP3926467A1 (en) Application control method and apparatus, terminal, and computer-readable storage medium
US20170329655A1 (en) Method and apparatus of unloading out of memory processing flow to user space
CN114327738B (en) Refreshing method and device of user interface, electronic equipment and readable storage medium
CN112463254A (en) Method, device and equipment for acquiring webpage loading time and storage medium
CN112073293A (en) Instant message reminding method and related device
CN112653736B (en) Parallel source returning method and device and electronic equipment
CN111177513A (en) Method and device for determining abnormal access address, electronic equipment and storage medium
CN112838980B (en) Message processing method, system, device, electronic equipment and storage medium
CN106550021B (en) Push method and device for push message
CN111857995B (en) Process scheduling method and device, storage medium and electronic device
CN114510299A (en) Method, device and storage medium for processing artificial intelligence service
CN109032814B (en) Mobile terminal, method for monitoring interprocess communication of mobile terminal and storage medium
CN111191134B (en) Intelligent pushing method and terminal
CN111427878B (en) Data monitoring alarm method, device, server and storage medium
EP3910911B1 (en) Method for service decision distribution among multiple terminal devices and system
CN113225698A (en) State information notification method, related device, system and medium
CN111988403A (en) Request processing method and system of electronic equipment, storage medium and electronic equipment
CN111625742A (en) Network request scheduling method, device, system and medium for large screen system
CN116233236B (en) Information pushing method, device, equipment and medium based on message queue
CN111698132B (en) Method, apparatus, device and medium for controlling heartbeat events in a cluster

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