CN114328676A - Time window detection method and device - Google Patents

Time window detection method and device Download PDF

Info

Publication number
CN114328676A
CN114328676A CN202210010275.8A CN202210010275A CN114328676A CN 114328676 A CN114328676 A CN 114328676A CN 202210010275 A CN202210010275 A CN 202210010275A CN 114328676 A CN114328676 A CN 114328676A
Authority
CN
China
Prior art keywords
time
time window
target
data
stamp
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.)
Pending
Application number
CN202210010275.8A
Other languages
Chinese (zh)
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.)
Vivo Mobile Communication Co Ltd
Original Assignee
Vivo Mobile Communication 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 Vivo Mobile Communication Co Ltd filed Critical Vivo Mobile Communication Co Ltd
Priority to CN202210010275.8A priority Critical patent/CN114328676A/en
Publication of CN114328676A publication Critical patent/CN114328676A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The application discloses a time window detection method and a time window detection device, and belongs to the technical field of communication. The method comprises the following steps: initializing a time window array, wherein the time window array comprises a plurality of timestamps in a target time period, and a time interval corresponding to every two adjacent timestamps is used as a time window; when data to be subjected to flow statistics is received, a target time window to which the time stamp of the data belongs is inquired from the time windows corresponding to each two adjacent time stamps in the time window array. The method improves the flexibility of time window configuration and improves the detection efficiency of the time window.

Description

Time window detection method and device
Technical Field
The embodiment of the application relates to the technical field of communication, in particular to a time window detection method and device.
Background
In the big data domain, it is often necessary to aggregate data in the time dimension. For example, in a data acquisition system, data traffic of multiple time windows needs to be counted to monitor and schedule the traffic. Therefore, it is necessary to detect a time window corresponding to each received data.
In the prior art, a plurality of time windows (for example: 08:01, 08:02, 08:03, etc. are set as one time window per minute) are usually preset, then the time stamp of the data is converted into an hour per minute, and the time window to which the data belongs is determined according to the hour per minute. The method is not only not easy to flexibly configure the time window, but also has low detection efficiency.
Disclosure of Invention
The embodiment of the application aims to provide a time window detection method and a time window detection device, which can solve the technical problems that a time window is not easy to flexibly configure and the detection efficiency of the time window is low.
In order to solve the technical problem, the present application is implemented as follows:
in a first aspect, an embodiment of the present application provides a time window detection method, where the method includes: initializing a time window array, wherein the time window array comprises a plurality of timestamps in a target time period, and a time interval corresponding to every two adjacent timestamps is used as a time window; and when data to be subjected to flow statistics is received, inquiring a target time window to which the time stamp of the data belongs from the time windows corresponding to each two adjacent time stamps in the time window array.
In a second aspect, an embodiment of the present application provides a time window detecting apparatus, where the apparatus includes: the device comprises an initialization unit, a time window processing unit and a time window control unit, wherein the initialization unit is used for initializing a time window array, the time window array comprises a plurality of timestamps positioned in a target time period, and a time interval corresponding to every two adjacent timestamps is used as a time window; and the query unit is used for querying a target time window to which the time stamp of the data belongs from the time windows corresponding to each two adjacent time stamps in the time window array when the data to be subjected to the flow statistics is received.
In a third aspect, embodiments of the present application provide an electronic device, which includes a processor, a memory, and a program or instructions stored on the memory and executable on the processor, where the program or instructions, when executed by the processor, implement the steps of the method as described in the first aspect.
In a fourth aspect, the present application provides a readable storage medium, on which a computer program is stored, which when executed by a processor implements the steps of the method as described in the first aspect above.
In a fifth aspect, an embodiment of the present application provides a chip, where the chip includes a processor and a communication interface, where the communication interface is coupled to the processor, and the processor is configured to execute a program or instructions to implement the method described in the first aspect.
In the embodiment of the application, by initializing a time window array including a plurality of timestamps in a target time period and taking a time interval corresponding to every two adjacent timestamps as a time window, when data to be subjected to flow statistics is received, a target time window to which the timestamp of the Giallo data belongs is queried from the time windows corresponding to the two adjacent timestamps in the time window array. Because the time window is determined based on the time stamps in the time window array, the time window can be flexibly configured in a mode of setting the time stamps, and the flexibility of time window configuration is improved. In addition, the query process of the time window does not need to convert the time stamp, and the detection efficiency of the time window is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of a time window detection method provided in an embodiment of the present application;
FIG. 2 is a schematic diagram of a time window array of a time window detection method according to an embodiment of the present application;
fig. 3 is a schematic diagram of a search process of a target time window in the time window detection method according to the embodiment of the present application;
fig. 4 is a schematic diagram of a detection result of the time window detection method provided in the embodiment of the present application;
fig. 5 is a schematic structural diagram of a time window detection apparatus according to an embodiment of the present application;
fig. 6 is a schematic diagram of a hardware structure of an electronic device suitable for implementing an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some, but not all, embodiments of the present application. 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 application.
The terms first, second and the like in the description and in the claims of the present application are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application are capable of operation in sequences other than those illustrated or described herein. In addition, "and/or" in the specification and claims means at least one of connected objects, a character "/" generally means that a preceding and succeeding related objects are in an "or" relationship.
The following describes in detail a time window detection method and apparatus provided in the embodiments of the present application with reference to the accompanying drawings and specific embodiments and application scenarios thereof.
Please refer to fig. 1, which shows a flowchart of a time window detection method according to an embodiment of the present application. The time window detection method provided by the embodiment of the application can be applied to electronic equipment. In practice, the electronic device may be a server, a smartphone, a tablet, a laptop, etc.
The flow of the time window detection method provided by the embodiment of the application comprises the following steps:
step 101, initializing a time window array.
In this embodiment, the execution subject of the time window detection method (e.g., the electronic device described above) may first initialize the time window array. The time window array is an array including a plurality of timestamps (timestamps). The timestamps contained in the time window array may be located within the target time period. The target time period may be determined based on the current time. For example, it may be a period of three hours before or after the current time.
In this embodiment, the time interval corresponding to each two adjacent timestamps may be regarded as a time window. The lengths of the time intervals corresponding to two adjacent timestamps may be the same or different, and may be set arbitrarily. For example, the time interval corresponding to each two adjacent timestamps may be 5 minutes; the time interval corresponding to a part of adjacent timestamps may be 1 minute, the time interval corresponding to another part of adjacent timestamps may be 2 minutes, and the time interval corresponding to another part of adjacent timestamps may be 5 minutes, and the like, and the present invention is not limited thereto.
By way of example, FIG. 2 shows a schematic diagram of a time window array. As shown in fig. 2, the time window array contains 24 time stamps in total. The 24 timestamps are all located in the target time periods "2021-08-2814: 00:00: 0" to "2021-08-2816: 00:00: 0". For example, the timestamp "1630130400000" may represent the time "2021-08-2814: 00:00: 0", the timestamp "1630130700000" may represent the time "2021-08-2814: 05:00: 0", and so on, which will not be described in detail herein.
In some optional implementations of this embodiment, the time window array may be initialized specifically through the following substeps S11 to substep S13:
and a sub-step S11 of determining a target time period based on the current time.
Here, a period made up of several hours before and after the current time may be taken as the target period.
In some examples, an hour-by-hour timestamp of the current time may be obtained first. The hour-by-hour timestamp is a timestamp corresponding to an hour (i.e., minutes, seconds, and milliseconds are all zero). For example, the current system time "2021-08-2815: 25:17: 8" corresponds to an hour integer of "2021-08-2815: 00:00: 0" and has an hour integer timestamp of "163013400000".
Thereafter, a period made up of several hours before and after the hour including the whole point may be taken as the target period. For example, the hour corresponding to the current time is "2021-08-2815: 00:00: 0", and the time periods formed by one hour before and after the current time are set as target time periods, i.e., "2021-08-2814: 00:00: 0" to "2021-08-2816: 00:00: 0".
And a substep S12 of selecting a plurality of timestamps within the target time interval based on the preset interval duration.
Here, the timestamp may be selected from the target time period according to a preset interval duration. The time interval between every two adjacent timestamps is the interval duration.
As an example, the interval duration is 5 minutes, and the target period is a period consisting of several hours before and after the current hour of whole hour, as in the above examples "2021-08-2814: 00:00: 0" to "2021-08-2816: 00:00: 0". At this point, the product may be divided into 12 equal parts per hour. Since the time stamps are directly selected, the time stamps can be obtained every 5 minutes in the target time period by directly using milliseconds as a time unit and adding or subtracting the interval duration of 300000ms (corresponding to the duration of 5 minutes) from the integral time corresponding to the current time, so that 24 time stamps are obtained.
Substep S13 summarizes the timestamps according to a chronological order to obtain a time window array.
Because the length of the time window array can be adjusted at will, the interval duration can also be adjusted flexibly, thereby improving the flexibility of time window configuration. In addition, the timestamp is calculated in a numerical value addition and subtraction mode in the process of the initial time window array, so that the calculation logic is simpler, the calculation speed is higher, and the reduction of the system performance is avoided. In addition, the target time interval is determined by a plurality of hours before and after the integral time of the current time, so that the time window array does not need to be updated within a long period of time, the updating frequency of the time window array is reduced, and the delayed data is convenient to process.
And 102, when data to be subjected to flow statistics is received, inquiring a target time window to which the time stamp of the data belongs from the time windows corresponding to each two adjacent time stamps in the time window array.
In this embodiment, when data to be subjected to traffic statistics is received, the execution main body may query, from the time windows corresponding to each two adjacent time stamps in the time window array, the time window to which the time stamp of the data belongs, and use the time window as a target time window. Therefore, the target time window corresponding to the received data can be determined, statistics and display of the data are facilitated, and subsequent scheduling, flow distribution and the like are facilitated. Wherein the time stamp of the data can be carried by the data.
The data to be subjected to traffic statistics may be various types of data, such as request data sent by a client, instructions sent by other devices, and the like, and is not specifically limited herein. Here, the operation of detecting the time window may be performed once every time data to be subjected to traffic statistics is received.
As an example, fig. 4 is a schematic view of the detection result. As shown in fig. 4, within the time window from 08:00 to 08:02, data (e.g., request data) is received twice, which may be denoted as "event 1" and "event 2", respectively. Within the time window 08:02 to 08:04, data is received once, which may be denoted as "event 3". Within the time window 08:04 to 08:06, three times of data are received, which may be denoted as "event 4", "event 5", "event 6", respectively. The statistical results may be increased in a tabular manner over time to show the total amount of data in each time window of the history.
In some optional implementation manners of this embodiment, after the target time window is determined, the execution main body may further determine a total amount of data corresponding to each time window, and display the total amount of data corresponding to each time window. Therefore, technicians can monitor the total data amount of each time window intuitively, and traffic scheduling, distribution and the like can be facilitated.
In some optional implementations of this embodiment, in a case that the time interval between every two adjacent timestamps in the time window array is the same, the execution subject may first query, from the time window array, a target timestamp whose difference from the timestamp of the data is a positive number and is less than or equal to the interval duration. Then, a time window formed by the target time stamp and the previous time stamp in the initialization time window can be used as the target time window.
By way of example, the data has a timestamp of "1630130730000". The ordered timestamps in the time window array are "1630130400000", "1630130700000", "1630131000000", "1630131300000", and so on, in that order. Since the difference between "1630131000000" and "1630130730000" is less than the interval duration 300000, "1630131000000" is the target timestamp. The previous timestamp in the initialization time window is "1630130700000". Thus, the time window "2021-08-2814: 05:00: 0" to "2021-08-2814: 10:00: 0" formed by "1630130700000" and "1630131000000" is the target time window.
In this implementation, when a target timestamp whose difference from the timestamp of the data is a positive number and less than or equal to the interval duration is queried, a binary search method may be used to search for the target time window.
As an example, fig. 3 shows a schematic diagram of a search process for a target time window. As shown in fig. 3, the time window array includes 24 time stamps, each of which may have an index number (e.g., 0 to 24). The client sends a data lookup request for looking up data with a timestamp of "1630144371303" and a corresponding time of "2021-08-2817: 52:51: 303". By a binary search, the timestamp with the index number in the middle, such as timestamp "1630141200000" with index number 12, may be queried first.
Since the difference between the time stamp "1630141200000" and the time stamp "1630144371303" of the data is "-3171303", the time stamp with the index number in the middle, for example, the time stamp "1630143000000" with the index number of 18, can be further selected from the time stamps with the index numbers from 13 to 24.
Since the difference between the time stamp "1630143000000" and the time stamp "1630144371303" of the data is "-1371303", the time stamp with the index number in the middle, for example, the time stamp "1630143900000" with the index number 21, can be further selected from the time stamps with the index numbers from 19 to 24.
Since the difference between the time stamp "1630143900000" and the time stamp "1630144371303" of the data is "-471303", the time stamp with the index number in the middle, for example, the time stamp "1630144500000" with the index number 23, can be further selected from the time stamps with the index numbers from 22 to 24.
Since the difference between this time stamp "1630144500000" and the time stamp "1630144371303" of the above data is "128697", the condition that the difference between the time stamps is a positive number and is less than or equal to the interval duration is satisfied, and therefore the time stamp "1630144500000" with the index number 23 can be determined as the target time stamp.
The target timestamp is searched in a binary searching mode, so that the searching difficulty of the target timestamp can be reduced, the searching speed of the target timestamp is increased, and the detection efficiency and the system performance of a target time window are improved.
In some optional implementations of this embodiment, the execution subject may further perform a search of the target time window by means of timestamp comparison. Specifically, the minimum timestamp greater than or equal to the timestamp of the data may be queried from the time window array, and a time window formed by the minimum timestamp and the previous timestamp in the initialization time window may be used as the target time window.
In some optional implementation manners of this embodiment, if the timestamp of the data is greater than the maximum timestamp in the time window array, it means that the timestamp of the data is not included in the target time period, and the target time period needs to be updated. At this time, the execution main body may update the target time interval based on the current time to obtain an updated target time interval, and update the time window array based on the updated target time interval. The manner of updating the target time interval is the same as the manner of determining the target time interval, and is not described herein again.
It should be noted that if the timestamp of the data is smaller than the minimum timestamp in the time window array, it means that the data is delayed too long. At this time, the data may be directly returned to the upper layer application for relevant processing, for example, a prompt message indicating that the request fails may be returned to the source device of the data, and the like, which is not limited herein.
In the method provided by the above embodiment of the present application, by initializing a time window array including a plurality of timestamps located in a target time period, and taking a time interval corresponding to every two adjacent timestamps as a time window, when data is received, a target time window to which a timestamp of the data belongs can be queried from the time window related to the time window array. Because the time window is determined based on the time stamps in the time window array, the time window can be flexibly configured in a mode of setting the time stamps, and the flexibility of time window configuration is improved. In addition, the time window corresponding to the data can be determined under the condition that the time stamp conversion is not carried out, and the detection efficiency of the time window is improved.
It should be noted that, in the time window detection method provided in the embodiment of the present application, the execution main body may be a time window detection device, or a control module in the time window detection device for executing the loading time window detection method. In the embodiment of the present application, a time window detection apparatus is taken as an example to execute a method for detecting a loaded time window, and the method for detecting a time window provided in the embodiment of the present application is described.
As shown in fig. 5, the time window detecting apparatus 500 of the present embodiment includes: an initializing unit 501, configured to initialize a time window array, where the time window array includes a plurality of timestamps located in a target time period, and a time interval corresponding to every two adjacent timestamps is used as a time window; the query unit 502 is configured to, when data to be subjected to traffic statistics is received, query a target time window to which a time stamp of the data belongs from time windows corresponding to each two adjacent time stamps in the time window array.
In some optional implementations of this embodiment, the initialization unit 501 is further configured to determine a target time period based on the current time; selecting a plurality of timestamps in the target time interval based on preset interval duration; and summarizing the plurality of timestamps according to the time sequence to obtain a time window array.
In some optional implementations of this embodiment, the querying unit 502 is further configured to query, from the time window array, a target time stamp whose difference between the time stamps of the data and the time stamp of the data is positive and smaller than or equal to the interval duration, and use a time window formed by the target time stamp and a previous time stamp in the initialization time window as the target time window.
In some optional implementations of this embodiment, the querying unit 502 is further configured to query, from the time window array, a minimum time stamp that is greater than or equal to a time stamp of the data, and use a time window formed by the minimum time stamp and a previous time stamp in the initialization time window as the target time window.
In some optional implementation manners of this embodiment, the apparatus further includes an updating unit, configured to update the target time period based on a current time to obtain an updated target time period when the timestamp of the data is greater than a maximum timestamp in the time window array, and update the time window array based on the updated target time period.
In some optional implementation manners of this embodiment, the apparatus further includes a display unit, configured to determine a total amount of data corresponding to each time window, and display the total amount of data corresponding to each time window.
The time window detection device in the embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in a terminal. The device can be mobile electronic equipment or non-mobile electronic equipment. By way of example, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palm top computer, a vehicle-mounted electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook or a Personal Digital Assistant (PDA), and the like, and the non-mobile electronic device may be a server, a Network Attached Storage (NAS), a Personal Computer (PC), a Television (TV), a teller machine or a self-service machine, and the like, and the embodiments of the present application are not particularly limited.
The time window detection device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, and embodiments of the present application are not limited specifically.
The time window detection device provided in the embodiment of the present application can implement each process implemented by the time window detection device in the method embodiment of fig. 1, and is not described here again to avoid repetition.
The apparatus provided in the foregoing embodiment of the present application initializes the time window array including the plurality of timestamps located in the target time period, and sets the time interval corresponding to every two adjacent timestamps as a time window, so that when data is received, the target time window to which the timestamp of the data belongs can be queried from the time window related to the time window array. Because the time window is determined based on the time stamps in the time window array, the time window can be flexibly configured in a mode of setting the time stamps, and the flexibility of time window configuration is improved. In addition, the time window corresponding to the data can be determined under the condition that the time stamp conversion is not carried out, and the detection efficiency of the time window is improved.
Optionally, an electronic device is further provided in this embodiment of the present application, and includes a processor 610, a memory 609, and a program or an instruction stored in the memory 609 and capable of running on the processor 610, where the program or the instruction is executed by the processor 610 to implement each process of the above time window detection method embodiment, and can achieve the same technical effect, and details are not described here to avoid repetition.
It should be noted that the electronic devices in the embodiments of the present application include the mobile electronic devices and the non-mobile electronic devices described above.
Fig. 6 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.
The electronic device 600 includes, but is not limited to: a radio frequency unit 601, a network module 602, an audio output unit 603, an input unit 604, a sensor 605, a display unit 606, a user input unit 607, an interface unit 608, a memory 609, a processor 610, and the like.
Those skilled in the art will appreciate that the electronic device 600 may further comprise a power source (e.g., a battery) for supplying power to the various components, and the power source may be logically connected to the processor 610 through a power management system, so as to implement functions of managing charging, discharging, and power consumption through the power management system. The electronic device structure shown in fig. 6 does not constitute a limitation of the electronic device, and the electronic device may include more or less components than those shown, or combine some components, or arrange different components, and thus, the description is omitted here.
The processor 610 is configured to use a time window array, where the time window array includes a plurality of timestamps located in a target time period, and a time interval corresponding to every two adjacent timestamps is used as a time window; and when data to be subjected to flow statistics is received, inquiring a target time window to which the time stamp of the data belongs from the time windows corresponding to each two adjacent time stamps in the time window array.
In the embodiment of the application, by initializing a time window array including a plurality of timestamps within a target time period and taking a time interval corresponding to every two adjacent timestamps as a time window, when data to be subjected to flow statistics is received, a target time window to which the timestamp of the data belongs is queried from the time window corresponding to each two adjacent timestamps in the time window array. Because the time window is determined based on the time stamps in the time window array, the time window can be flexibly configured in a mode of setting the time stamps, and the flexibility of time window configuration is improved. In addition, the time window corresponding to the data can be determined under the condition that the time stamp conversion is not carried out, and the detection efficiency of the time window is improved.
Optionally, the processor 610 is further configured to determine a target time period based on the current time; selecting a plurality of timestamps in the target time period based on a preset interval duration; and summarizing the plurality of timestamps according to the time sequence to obtain a time window array.
Optionally, the processor 610 is further configured to query, from the time window array, a target time stamp whose difference from the time stamp of the data is positive and is less than or equal to the interval duration, and use a time window formed by the target time stamp and the previous time stamp in the initialization time window as the target time window.
Optionally, the processor 610 is further configured to query a minimum timestamp that is greater than or equal to the timestamp of the data from the time window array, and use a time window formed by the minimum timestamp and a previous timestamp in the initialization time window as the target time window.
Optionally, the processor 610 is further configured to update the target time period based on the current time to obtain an updated target time period when the timestamp of the data is greater than the maximum timestamp in the time window array, and update the time window array based on the updated target time period.
Optionally, the processor 610 is further configured to determine a total amount of data corresponding to each time window, and control the display unit 606 to display the total amount of data corresponding to each time window.
It is to be understood that, in the embodiment of the present application, the input Unit 604 may include a Graphics Processing Unit (GPU) 6041 and a microphone 6042, and the Graphics Processing Unit 6041 processes image data of a still picture or a video obtained by an image capturing apparatus (such as a camera) in a video capturing mode or an image capturing mode. The display unit 606 may include a display panel 6061, and the display panel 6061 may be configured in the form of a liquid crystal display, an organic light emitting diode, or the like. The user input unit 607 includes a touch panel 6071 and other input devices 6072. A touch panel 6071, also referred to as a touch screen. The touch panel 6071 may include two parts of a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein. The memory 609 may be used to store software programs as well as various data including, but not limited to, application programs and an operating system. The processor 610 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 610.
The embodiment of the present application further provides a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or the instruction is executed by a processor, the program or the instruction implements each process of the time window detection method embodiment, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here.
The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and so on.
The embodiment of the present application further provides a chip, where the chip includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or an instruction to implement each process of the time window detection method embodiment, and can achieve the same technical effect, and in order to avoid repetition, the description is omitted here.
It should be understood that the chips mentioned in the embodiments of the present application may also be referred to as system-on-chip, system-on-chip or system-on-chip, etc.
It should be noted that, in this document, 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 like elements in a process, method, article, or apparatus that comprises the element. Further, it should be noted that the scope of the methods and apparatus of the embodiments of the present application is not limited to performing the functions in the order illustrated or discussed, but may include performing the functions in a substantially simultaneous manner or in a reverse order based on the functions involved, e.g., the methods described may be performed in an order different than that described, and various steps may be added, omitted, or combined. In addition, features described with reference to certain examples may be combined in other examples.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
While the present embodiments have been described with reference to the accompanying drawings, it is to be understood that the invention is not limited to the precise embodiments described above, which are meant to be illustrative and not restrictive, and that various changes may be made therein by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (10)

1. A method for time window detection, the method comprising:
initializing a time window array, wherein the time window array comprises a plurality of timestamps in a target time period, and a time interval corresponding to every two adjacent timestamps is used as a time window;
and when data to be subjected to flow statistics is received, inquiring a target time window to which the time stamp of the data belongs from the time windows corresponding to each two adjacent time stamps in the time window array.
2. The method of claim 1, wherein initializing the time window array comprises:
determining a target time period based on the current time;
selecting a plurality of timestamps in the target time period based on a preset interval duration;
and summarizing the plurality of timestamps according to the time sequence to obtain a time window array.
3. The method according to claim 2, wherein the querying a target time window to which the time stamp of the data belongs from the time windows corresponding to each two adjacent time stamps in the time window array comprises:
and inquiring a target time stamp with a positive time difference with the time stamp of the data and less than or equal to the interval duration from the time window array, and taking a time window formed by the target time stamp and the previous time stamp in the time window array as a target time window.
4. The method according to claim 1, wherein the querying a target time window to which the time stamp of the data belongs from the time windows corresponding to each two adjacent time stamps in the time window array comprises:
and inquiring a minimum time stamp which is greater than or equal to the time stamp of the data from the time window array, and taking a time window formed by the minimum time stamp and a previous time stamp in the time window as a target time window.
5. The method of claim 1, further comprising:
and under the condition that the timestamp of the data is greater than the maximum timestamp in the time window array, updating the target time interval based on the current time to obtain an updated target time interval, and updating the time window array based on the updated target time interval.
6. A time window detection apparatus, the apparatus comprising:
the device comprises an initialization unit, a time window processing unit and a time window control unit, wherein the initialization unit is used for initializing a time window array, the time window array comprises a plurality of timestamps positioned in a target time period, and a time interval corresponding to every two adjacent timestamps is used as a time window;
and the query unit is used for querying a target time window to which the time stamp of the data belongs from the time windows corresponding to each two adjacent time stamps in the time window array when the data to be subjected to the flow statistics is received.
7. The apparatus of claim 1, wherein the initialization unit is further configured to:
determining a target time period based on the current time;
selecting a plurality of timestamps in the target time period based on a preset interval duration;
and summarizing the plurality of timestamps according to the time sequence to obtain a time window array.
8. The apparatus of claim 7, wherein the querying element is further configured to:
and inquiring a target time stamp with a positive time difference with the time stamp of the data and less than or equal to the interval duration from the time window array, and taking a time window formed by the target time stamp and the previous time stamp in the time window array as a target time window.
9. The apparatus of claim 6, wherein the querying element is further configured to:
and inquiring a minimum time stamp which is greater than or equal to the time stamp of the data from the time window array, and taking a time window formed by the minimum time stamp and a previous time stamp in the time window as a target time window.
10. The apparatus of claim 6, further comprising:
and the updating unit is used for updating the target time interval based on the current time to obtain an updated target time interval and updating the time window array based on the updated target time interval under the condition that the time stamp of the data is greater than the maximum time stamp in the time window array.
CN202210010275.8A 2022-01-05 2022-01-05 Time window detection method and device Pending CN114328676A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210010275.8A CN114328676A (en) 2022-01-05 2022-01-05 Time window detection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210010275.8A CN114328676A (en) 2022-01-05 2022-01-05 Time window detection method and device

Publications (1)

Publication Number Publication Date
CN114328676A true CN114328676A (en) 2022-04-12

Family

ID=81024748

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210010275.8A Pending CN114328676A (en) 2022-01-05 2022-01-05 Time window detection method and device

Country Status (1)

Country Link
CN (1) CN114328676A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100815866B1 (en) * 2007-01-25 2008-03-24 인하대학교 산학협력단 Time stamp based sampling method of data stream
CN106487608A (en) * 2015-08-31 2017-03-08 华为技术服务有限公司 The method and apparatus of measurement far-end timestamp unit
CN109726597A (en) * 2018-12-29 2019-05-07 杭州趣链科技有限公司 Trusted timestamp system based on block chain
CN110943796A (en) * 2019-11-19 2020-03-31 深圳市道通智能航空技术有限公司 Timestamp alignment method, timestamp alignment device, storage medium and equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100815866B1 (en) * 2007-01-25 2008-03-24 인하대학교 산학협력단 Time stamp based sampling method of data stream
CN106487608A (en) * 2015-08-31 2017-03-08 华为技术服务有限公司 The method and apparatus of measurement far-end timestamp unit
CN109726597A (en) * 2018-12-29 2019-05-07 杭州趣链科技有限公司 Trusted timestamp system based on block chain
CN110943796A (en) * 2019-11-19 2020-03-31 深圳市道通智能航空技术有限公司 Timestamp alignment method, timestamp alignment device, storage medium and equipment

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
""r1-20xxxxx - fl summary on enhancements on ul time and frequency synchronization_v042_intel_huawei"", 3GPP TSG_RAN\\WG1_RL1, 24 August 2020 (2020-08-24) *
J.D. MARTINEZ、J.M. MONZO: ""Digital delay line shaping-zero crossing algorithm for timestamp extraction in PET"", 《2008 IEEE NUCLEAR SCIENCE SYMPOSIUM CONFERENCE RECORD》, 6 February 2009 (2009-02-06) *
刘月明、董航: ""一种基于以太网传输提高时间戳精度的方法"", 《光通信研究》, no. 01, 20 November 2020 (2020-11-20), pages 30 - 35 *

Similar Documents

Publication Publication Date Title
CN111984162A (en) Page display method and device and electronic equipment
CN112035320B (en) Service monitoring method and device, electronic equipment and readable storage medium
CN112540996B (en) Service data verification method and device, electronic equipment and storage medium
CN112702261B (en) Information display method and device and electronic equipment
CN113194200B (en) Message display method and device and electronic equipment
CN112083854A (en) Application program running method and device
CN112486444A (en) Screen projection method, device, equipment and readable storage medium
CN113596555A (en) Video playing method and device and electronic equipment
CN111865763A (en) Message display method and device, electronic equipment and storage medium
CN106648916B (en) Method and device for reporting pedometer message
CN112286611A (en) Icon display method and device and electronic equipment
CN112016080A (en) Application authority management method and device and electronic equipment
CN111741053A (en) Data pre-downloading method, device, server, terminal and storage medium
CN114328676A (en) Time window detection method and device
CN113687942B (en) Detection method and device and electronic equipment
CN113239212B (en) Information processing method and device and electronic equipment
CN111897464B (en) Operation execution method and device
CN114398127A (en) Message display method and device
CN114528187A (en) Power consumption management method and device
CN113794920A (en) Interface display method and device, electronic equipment and medium
CN109799715B (en) Data receiving method, device and terminal equipment
CN113225830A (en) Data network uplink scheduling method and device and electronic equipment
CN112437196B (en) Page display method and device and electronic equipment
CN113589916B (en) Memory control method and device
CN118349097A (en) Power consumption detection method, device, electronic equipment, medium and computer program product

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