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 window
time
target
timestamp
data
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 embodiments of the present application relate to the field of communication technologies, and in particular, to a time window detection method and apparatus.

背景技术Background technique

在大数据领域,通常需要按照时间维度聚合数据。比如,在数据采集系统中,需要对多个时间窗口的数据流量进行统计,以进行流量的监控和调度等。因此,需要对所接收到的各数据对应的时间窗口进行检测。In the field of big data, it is usually necessary to aggregate data according to the time dimension. For example, in a data acquisition system, data traffic in multiple time windows needs to be counted for traffic monitoring and scheduling. Therefore, it is necessary to detect the time window corresponding to each received data.

现有技术中,通常预先设置多个时间窗口(如:08:01、08:02、08:03等每分钟作为一个时间窗口),而后将数据的时间戳转换为整点分钟,根据整点分钟确定数据所属的时间窗口。这种方式不仅不易灵活配置时间窗口,且检测效率较低。In the prior art, multiple time windows are usually set in advance (for example, 08:01, 08:02, 08:03, etc. are used as a time window every minute), and then the time stamp of the data is converted into an hourly minute, according to the hourly hour. Minutes determine the time window to which the data belongs. This method is not only difficult to flexibly configure the time window, but also has low detection efficiency.

发明内容SUMMARY OF THE INVENTION

本申请实施例的目的是提供一种时间窗口检测方法和装置,能够解决时间窗口不易灵活配置以及时间窗口的检测效率较低的技术问题。The purpose of the embodiments of the present application is to provide a time window detection method and device, which can solve the technical problems that the time window is not easy to configure flexibly and the detection efficiency of the time window is low.

为了解决上述技术问题,本申请是这样实现的:In order to solve the above technical problems, this application is implemented as follows:

第一方面,本申请实施例提供了一种时间窗口检测方法,所述方法包括:初始化时间窗口数组,所述时间窗口数组中包括位于目标时段内的多个时间戳,每两个相邻时间戳对应的时间区间作为一个时间窗口;在接收到待进行流量统计的数据时,从所述时间窗口数组中各相邻两时间戳对应的时间窗口中,查询所述数据的时间戳所属的目标时间窗口。In a first aspect, an embodiment of the present application provides a time window detection method, the method includes: initializing a time window array, where the time window array includes a plurality of time stamps located in a target time period, and every two adjacent times The time interval corresponding to the stamp is used as a time window; when the data to be counted is received, the target to which the time stamp of the data belongs is queried from the time windows corresponding to two adjacent time stamps in the time window array. time window.

第二方面,本申请实施例提供了一种时间窗口检测装置,所述装置包括:初始化单元,用于初始化时间窗口数组,所述时间窗口数组中包括位于目标时段内的多个时间戳,每两个相邻时间戳对应的时间区间作为一个时间窗口;查询单元,用于在接收到待进行流量统计的数据时,从所述时间窗口数组中各相邻两时间戳对应的时间窗口中,查询所述数据的时间戳所属的目标时间窗口。In a second aspect, an embodiment of the present application provides a time window detection device, the device includes: an initialization unit configured to initialize a time window array, where the time window array includes a plurality of time stamps located in a target time period, each time The time interval corresponding to the two adjacent time stamps is used as a time window; the query unit is used to, when receiving the data to be subjected to traffic statistics, from the time windows corresponding to the two adjacent time stamps in the time window array, Queries the target time window to which the timestamp of the data belongs.

第三方面,本申请实施例提供了一种电子设备,包括处理器、存储器及存储在存储器上并可在处理器上运行的程序或指令,程序或指令被处理器执行时实现如上述第一方面所描述的方法的步骤。In a third aspect, an embodiment of the present application provides an electronic device, including a processor, a memory, and a program or instruction stored in the memory and executable on the processor. When the program or instruction is executed by the processor, the above-mentioned first The steps of the method described in the aspect.

第四方面,本申请实施例提供了一种可读存储介质,可读存储介质上存储计算机程序,计算机程序被处理器执行时实现如上述第一方面所描述的方法的步骤。In a fourth aspect, an embodiment of the present application provides a readable storage medium, where a computer program is stored on the readable storage medium, and when the computer program is executed by a processor, the steps of the method described in the first aspect above are implemented.

第五方面,本申请实施例提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现如第一方面所描述的方法。In a fifth aspect, an embodiment of the present application provides a chip, 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, and implement the first aspect the described method.

在本申请实施例中,通过初始化包含位于目标时段内的多个时间戳的时间窗口数组,并将每两个相邻时间戳对应的时间区间作为一个时间窗口,从而在接收到待进行流量统计的数据时,从时间窗口数组中各相邻两时间戳对应的时间窗口中,查询Giallo数据的时间戳所属的目标时间窗口。由于时间窗口基于时间窗口数组中的时间戳确定,因此可通过设定时间戳的方式,灵活配置时间窗口,提高了时间窗口配置的灵活性。此外,时间窗口的查询过程不需要进行时间戳的转换,提高了时间窗口的检测效率。In this embodiment of the present application, by initializing a time window array including multiple time stamps within the target time period, and using the time interval corresponding to every two adjacent time stamps as a time window, traffic statistics to be performed after receiving , query the target time window to which the timestamp of the Giallo data belongs from the time windows corresponding to two adjacent timestamps in the time window array. Since the time window is determined based on the timestamps in the time window array, the time window can be flexibly configured by setting the timestamp, which improves the flexibility of the time window configuration. In addition, the query process of the time window does not need to perform timestamp conversion, which improves the detection efficiency of the time window.

附图说明Description of drawings

通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

图1是本申请实施例提供的时间窗口检测方法的流程图之一;Fig. 1 is one of the flowcharts of the time window detection method provided by the embodiment of the present application;

图2是本申请实施例提供的时间窗口检测方法的时间窗口数组的示意图;2 is a schematic diagram of a time window array of a time window detection method provided by an embodiment of the present application;

图3是本申请实施例提供的时间窗口检测方法的目标时间窗口的查找过程示意图;3 is a schematic diagram of a search process of a target time window of a time window detection method provided by an embodiment of the present application;

图4是本申请实施例提供的时间窗口检测方法的检测结果示意图;4 is a schematic diagram of a detection result of a time window detection method provided by an embodiment of the present application;

图5是本申请实施例提供的时间窗口检测装置的结构示意图;5 is a schematic structural diagram of a time window detection device provided by an embodiment of the present application;

图6是适于用来实现本申请实施例的电子设备的硬件结构示意图。FIG. 6 is a schematic diagram of a hardware structure of an electronic device suitable for implementing an embodiment of the present application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.

本申请的说明书和权利要求书中的术语“第一”、“第二”等是用于区别类似的对象,而不用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便本申请的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,说明书以及权利要求中“和/或”表示所连接对象的至少其中之一,字符“/”,一般表示前后关联对象是一种“或”的关系。The terms "first", "second" and the like in the description and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that embodiments of the application can be practiced in sequences other than those illustrated or described herein. In addition, "and/or" in the description and claims indicates at least one of the connected objects, and the character "/" generally indicates that the associated objects are in an "or" relationship.

下面结合附图,通过具体的实施例及其应用场景对本申请实施例提供的时间窗口检测方法和装置进行详细地说明。The method and apparatus for detecting a time window provided by the embodiments of the present application will be described in detail below through specific embodiments and application scenarios with reference to the accompanying drawings.

请参考图1,其示出了本申请实施例提供的时间窗口检测方法的流程图之一。本申请实施例提供的时间窗口检测方法,可以应用于电子设备。实践中,上述电子设备可以是服务器、智能手机、平板电脑、膝上型便携计算机等电子设备。Please refer to FIG. 1 , which shows one of the flowcharts of the time window detection method provided by the embodiment of the present application. The time window detection method provided by the embodiments of the present application can be applied to electronic devices. In practice, the above-mentioned electronic devices may be electronic devices such as servers, smart phones, tablet computers, laptop computers, and the like.

本申请实施例提供的时间窗口检测方法的流程,包括以下步骤:The process of the time window detection method provided by the embodiment of the present application includes the following steps:

步骤101,初始化时间窗口数组。Step 101, initialize the time window array.

在本实施例中,时间窗口检测方法的执行主体(如上述电子设备)可以首先初始化时间窗口数组。其中,时间窗口数组为一个包含多个时间戳(Timestamp)的数组。时间窗口数组中所包含的时间戳可位于目标时段内。目标时段可基于当前时间确定。例如,可以是当前时间前后共三小时所构成的时段。In this embodiment, the execution body of the time window detection method (such as the above electronic device) may first initialize the time window array. The time window array is an array containing multiple timestamps (Timestamps). Timestamps contained in the time window array can be within the target period. The target period may be determined based on the current time. For example, it can be a period of three hours before and after the current time.

在本实施例中,每两个相邻时间戳对应的时间区间可以作为一个时间窗口。其中,相邻两个时间戳对应的时间区间的长度可以相同或者不同,且可以任意设定。例如,每两个相邻时间戳对应的时间区间可均为5分钟;也可以部分相邻时间戳对应的时间区间为1分钟,另一部分相邻时间戳对应的时间区间为2分钟,再一部分相邻时间戳对应的时间区间为5分钟等,此处不作具体限定。In this embodiment, the time interval corresponding to every two adjacent time stamps may be used as a time window. The lengths of time intervals corresponding to two adjacent time stamps 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; it is also possible that the time interval corresponding to some adjacent timestamps is 1 minute, the time interval corresponding to another part of the adjacent timestamps is 2 minutes, and another part The time interval corresponding to the adjacent time stamps is 5 minutes, etc., which is not specifically limited here.

作为示例,图2示出了时间窗口数组的示意图。如图2所示,时间窗口数组中共包含24个时间戳。24个时间戳均位于目标时段“2021-08-2814:00:00:0”至“2021-08-28 16:00:00:0”中。例如,时间戳“1630130400000”可表示时间“2021-08-28 14:00:00:0”、时间戳“1630130700000”可表示时间“2021-08-28 14:05:00:0”等,此处不再一一赘述。As an example, Figure 2 shows a schematic diagram of an array of time windows. As shown in Figure 2, the time window array contains a total of 24 timestamps. The 24 timestamps are all in the target period "2021-08-2814:00:00:0" to "2021-08-28 16:00:00:0". For example, the time stamp "1630130400000" can represent the time "2021-08-28 14:00:00:0", the time stamp "1630130700000" can represent the time "2021-08-28 14:05:00:0", etc. I won't go into details here.

在本实施例的一些可选的实现方式中,具体可通过如下子步骤S11至子步骤S13初始化时间窗口数组:In some optional implementations of this embodiment, the time window array may be initialized by the following sub-steps S11 to S13:

子步骤S11,基于当前时间确定目标时段。In sub-step S11, the target time period is determined based on the current time.

此处,可以将当前时间前后若干小时所构成的时段作为目标时段。Here, a period formed by several hours before and after the current time can be used as the target period.

在一些示例中,可以首先获取当前时间的整点小时时间戳。其中,整点小时时间戳即为整点小时(即分、秒、毫秒均为零)对应的时间戳。例如,当前系统时间“2021-08-28 15:25:17:8”对应的整点小时为“2021-08-28 15:00:00:0”,其整点小时时间戳为“163013400000”。In some examples, the hourly hour timestamp of the current time may be obtained first. The timestamp of the hour on the hour is the timestamp corresponding to the hour on the hour (ie, minutes, seconds, and milliseconds are all zero). For example, the hourly hour corresponding to the current system time "2021-08-28 15:25:17:8" is "2021-08-28 15:00:00:0", and its hourly hour timestamp is "163013400000" .

之后,可以将包含整点小时的前后若干小时所构成的时段作为目标时段。例如,当前时间对应的整点小时为“2021-08-28 15:00:00:0”,可将前后各一小时所构成的时段作为目标时段,即“2021-08-28 14:00:00:0”至“2021-08-28 16:00:00:0”。Afterwards, a period consisting of several hours before and after the hour can be used as the target period. For example, the hour corresponding to the current time is "2021-08-28 15:00:00:0", and the period formed by one hour before and after can be used as the target period, that is, "2021-08-28 14:00: 00:0" to "2021-08-28 16:00:00:0".

子步骤S12,基于预设的间隔时长,选取目标时段内的多个时间戳。Sub-step S12, based on a preset interval duration, select multiple time stamps within the target time period.

此处,可以按照预设的间隔时长从目标时段内进行时间戳的选取。所选取的每两个相邻时间戳的时间间隔即为上述间隔时长。Here, timestamps may be selected from the target time period according to a preset interval duration. The selected time interval between two adjacent time stamps is the above interval duration.

作为示例,间隔时长为5分钟,目标时段为包含当前整点小时的前后若干小时所构成的时段,如上述示例中的“2021-08-28 14:00:00:0”至“2021-08-28 16:00:00:0”。此时,每小时可切分为12等份。由于此处直接进行时间戳的选取,因此可直接使用毫秒作为时间单位,从当前时间对应的整点时间起,每次加减300000ms(对应5分钟的时长)的间隔时长,即可得到目标时段内每隔5分钟的时间戳,共得到24个时间戳。As an example, the interval is 5 minutes, and the target period is a period consisting of several hours before and after the current hour, such as "2021-08-28 14:00:00:0" to "2021-08" in the above example -28 16:00:00:0". At this point, every hour can be divided into 12 equal parts. Since the timestamp is directly selected here, milliseconds can be used directly as the time unit. From the hourly time corresponding to the current time, the target period can be obtained by adding or subtracting the interval of 300000ms (corresponding to 5 minutes) each time. Timestamp every 5 minutes, a total of 24 timestamps are obtained.

子步骤S13将多个时间戳按照时间先后顺序进行汇总,得到时间窗口数组。Sub-step S13 aggregates multiple timestamps in chronological order to obtain a time window array.

由于时间窗口数组的长度可以任意调整,间隔时长也可以灵活调整,由此可提高时间窗口配置的灵活性。另外,由于初始时间窗口数组的过程中通过数值加减方式进行时间戳的计算,计算逻辑较为简单,使得计算速度更快,避免了系统性能的降低。此外,由于目标时段通过当前时间所在的整点时间的前后若干小时确定,因此可在较长一段时间内无需更新时间窗口数组,减少了时间窗口数组的更新频率,且便于处理延时数据。Since the length of the time window array can be adjusted arbitrarily, the interval duration can also be adjusted flexibly, thereby improving the flexibility of time window configuration. In addition, since the time stamp is calculated by numerical addition and subtraction in the process of the initial time window array, the calculation logic is relatively simple, which makes the calculation speed faster and avoids the reduction of system performance. In addition, since the target time period is determined by several hours before and after the hourly time at which the current time is located, it is unnecessary to update the time window array for a long period of time, which reduces the update frequency of the time window array and facilitates the processing of delayed data.

步骤102,在接收到待进行流量统计的数据时,从时间窗口数组中各相邻两时间戳对应的时间窗口中,查询上述数据的时间戳所属的目标时间窗口。Step 102: When receiving the data to be counted for traffic, from the time windows corresponding to two adjacent time stamps in the time window array, query the target time window to which the time stamp of the data belongs.

在本实施例中,在接收到待进行流量统计的数据时,上述执行主体可以从时间窗口数组中各相邻两时间戳对应的时间窗口中,查询该数据的时间戳所属的时间窗口,并将其作为目标时间窗口。由此可确定所接收到的数据所对应的目标时间窗口,便于进行数据的统计和展示,以及便于后续进行调度和流量分配等。其中,数据的时间戳可由数据所携带。In this embodiment, when receiving the data to be subjected to traffic statistics, the above-mentioned execution body may query the time window to which the time stamp of the data belongs from the time windows corresponding to two adjacent time stamps in the time window array, and Use this as the target time window. In this way, the target time window corresponding to the received data can be determined, which facilitates the statistics and display of the data, and facilitates subsequent scheduling and traffic allocation. The timestamp of the data may 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 the client, instructions sent by other devices, etc., which are not specifically limited here. Here, every time the data to be counted is received, the operation of detecting the time window may be performed once.

作为示例,图4是检测结果示意图。如图4所示,在08:00至08:02的时间窗口内,接收到两次数据(如请求数据),可分别为可表示为“事件1”、“事件2”。在08:02至08:04的时间窗口内,接收到一次数据,可表示为“事件3”。在08:04至08:06的时间窗口内,接收到三次数据,可分别表示为“事件4”、“事件5”、“事件6”。随着时间的变化,统计结果可以列表形式逐步增加,以显示出历史各个时间窗口中的数据总量。As an example, FIG. 4 is a schematic diagram of the detection result. As shown in FIG. 4 , in the time window from 08:00 to 08:02, two data (such as request data) are received, which can be represented as “event 1” and “event 2” respectively. In the time window from 08:02 to 08:04, data is received once, which can be represented as "event 3". In the time window from 08:04 to 08:06, three data are received, which can be represented as "event 4", "event 5", and "event 6" respectively. With the change of time, the statistical results can be gradually increased in the form of a list to display the total amount of data in each time window of history.

在本实施例的一些可选的实现方式中,在确定目标时间窗口后,上述执行主体还可以确定各时间窗口对应的数据总量,并对各时间窗口对应的数据总量进行展示。由此可便于技术人员直观地对各时间窗口的数据总量进行监控,由此可便于进行流量调度和分配等。In some optional implementations of this embodiment, after determining the target time window, the above-mentioned execution body may further determine the total amount of data corresponding to each time window, and display the total amount of data corresponding to each time window. In this way, it is convenient for technicians to monitor the total amount of data in each time window intuitively, thereby facilitating traffic scheduling and distribution.

在本实施例的一些可选的实现方式中,在时间窗口数组中每两个相邻时间戳的时间间隔相同的情况下,上述执行主体首先可以从时间窗口数组中,查询与上述数据的时间戳之差为正数且小于或等于间隔时长的目标时间戳。而后,可将初始化时间窗口中目标时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。In some optional implementations of this embodiment, in the case that the time interval between every two adjacent timestamps in the time window array is the same, the above-mentioned execution subject may first query the time between the above-mentioned data from the time-window array Target timestamps where the difference between stamps is positive and less than or equal to the interval duration. Then, the time window formed by the target time stamp and the previous time stamp in the initialization time window may be used as the target time window.

作为示例,数据的时间戳为“1630130730000”。时间窗口数组中的有序的时间戳依次为“1630130400000”、“1630130700000”、“1630131000000”、“1630131300000”等。由于“1630131000000”与“1630130730000”的差值小于间隔时长300000,因此“1630131000000”即为目标时间戳。初始化时间窗口中的前一时间戳即为“1630130700000”。由此,“1630130700000”与“1630131000000”所构成的时间窗口“2021-08-28 14:05:00:0”至“2021-08-28 14:10:00:0”,即为目标时间窗口。As an example, the timestamp of the data is "1630130730000". The ordered timestamps in the time window array are "1630130400000", "1630130700000", "1630131000000", "1630131300000", and so on. Since the difference between "1630131000000" and "1630130730000" is less than the interval 300000, "1630131000000" is the target timestamp. The previous timestamp in the initialization time window is "1630130700000". Therefore, the time window "2021-08-28 14:05:00:0" to "2021-08-28 14:10:00:0" constituted by "1630130700000" and "1630131000000" is the target time window .

在此实现方式中,在查询与上述数据的时间戳之差为正数且小于或等于间隔时长的目标时间戳时,可以使用二分查找方式进行目标时间窗口的查找。In this implementation manner, when the difference between the time stamp of the query and the above data is a positive number and is less than or equal to the target time stamp of the interval duration, a binary search method can be used to search for the target time window.

作为示例,图3示出了目标时间窗口的查找过程示意图。如图3所示,时间窗口数组中包括24个时间戳,每个时间戳可具有索引编号(如0至24)。客户端发送了数据查找请求,该请求用于查找数据,其时间戳为“1630144371303”,对应的时间为“2021-08-28 17:52:51:303”。通过二分查找,可首先查询索引编号位于中间的时间戳,如索引编号为12的时间戳“1630141200000”。As an example, FIG. 3 shows a schematic diagram of the search process of the target time window. As shown in FIG. 3 , the time window array includes 24 timestamps, and each timestamp may have an index number (eg, 0 to 24). The client sends a data lookup request, which is used to look up data. The timestamp is "1630144371303", and the corresponding time is "2021-08-28 17:52:51:303". Through binary search, you can first query the timestamp with the index number in the middle, such as the timestamp "1630141200000" with the index number 12.

由于该时间戳“1630141200000”与上述数据的时间戳“1630144371303”的差值为“-3171303”,因此可进一步从索引编号从13至24的时间戳中,选取编号位于中间的时间戳,如索引编号为18的时间戳“1630143000000”。Since the difference between the timestamp "1630141200000" and the timestamp "1630144371303" of the above data is "-3171303", the timestamp with the index number in the middle can be selected from the timestamps with index numbers from 13 to 24, such as index Timestamp "1630143000000" with number 18.

由于该时间戳“1630143000000”与上述数据的时间戳“1630144371303”的差值为“-1371303”,因此可进一步从索引编号从19至24的时间戳中,选取编号位于中间的时间戳,如索引编号为21的时间戳“1630143900000”。Since the difference between the timestamp "1630143000000" and the timestamp "1630144371303" of the above data is "-1371303", the timestamp with the index number in the middle can be selected from the timestamps with index numbers from 19 to 24, such as index Timestamp "1630143900000" with number 21.

由于该时间戳“1630143900000”与上述数据的时间戳“1630144371303”的差值为“-471303”,因此可进一步从索引编号从22至24的时间戳中,选取编号位于中间的时间戳,如索引编号为23的时间戳“1630144500000”。Since the difference between the timestamp "1630143900000" and the timestamp "1630144371303" of the above data is "-471303", the timestamp with the index number in the middle can be selected from the timestamps with index numbers from 22 to 24, such as index Timestamp "1630144500000" with number 23.

由于该时间戳“1630144500000”与上述数据的时间戳“1630144371303”的差值为“128697”,满足时间戳之差为正数且小于或等于间隔时长的条件,因此可将索引编号为23的时间戳“1630144500000”确定为目标时间戳。Since the difference between the timestamp "1630144500000" and the timestamp "1630144371303" of the above data is "128697", which satisfies the condition that the difference between the timestamps is positive and less than or equal to the interval duration, the index number can be set to the time of 23 The stamp "1630144500000" is determined as the target timestamp.

通过二分查找的方式进行目标时间戳的查找,可降低目标时间戳的查找难度,提高目标时间戳的查找速度,从而提高目标时间窗口的检测效率以及系统性能。Searching for the target timestamp by means of binary search can reduce the difficulty of searching the target timestamp and improve the searching speed of the target timestamp, thereby improving the detection efficiency of the target time window and the system performance.

在本实施例的一些可选的实现方式中,上述执行主体还可以通过时间戳比较的方式进行目标时间窗口的查找。具体地,可以从时间窗口数组中,查询大于或等于数据的时间戳的最小时间戳,将初始化时间窗口中最小时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。In some optional implementation manners of this embodiment, the above-mentioned execution body may also search for the target time window by comparing timestamps. Specifically, the minimum timestamp greater than or equal to the timestamp of the data can be queried from the time window array, and the time window formed by the minimum timestamp in the initialization time window and the previous timestamp is used as the target time window.

在本实施例的一些可选的实现方式中,若上述数据的时间戳大于时间窗口数组中的最大时间戳,则意味着目标时段内已经不包含上述数据的时间戳,需要对目标时段进行更新。此时,上述执行主体可以基于当前时间更新目标时段,得到更新后的目标时段,并基于更新后的目标时段,更新时间窗口数组。更新目标时段的方式与确定目标时段的方式相同,此处不再赘述。In some optional implementations of this embodiment, if the timestamp of the above data is greater than the maximum timestamp in the time window array, it means that the timestamp of the above data is no longer included in the target period, and the target period needs to be updated . At this time, the above-mentioned execution body may update the target period based on the current time, obtain the updated target period, and update the time window array based on the updated target period. The manner of updating the target period is the same as the manner of determining the target period, and details are not described herein again.

需要说明的是,若上述数据的时间戳小于时间窗口数组中的最小时间戳,则意味着该数据延迟太久了。此时可直接返回至上层应用进行相关处理,如可向该数据的来源设备返回请求失败的提示信息等,此处不作具体限定。It should be noted that if the timestamp of the above data is less than the minimum timestamp in the time window array, it means that the data is delayed for too long. At this time, it can directly return to the upper-layer application for related processing, for example, it can return a prompt message that the request fails to the source device of the data, etc., which is not specifically limited here.

本申请的上述实施例提供的方法,通过初始化包含位于目标时段内的多个时间戳的时间窗口数组,并将每两个相邻时间戳对应的时间区间作为一个时间窗口,从而在接收到数据时,可从时间窗口数组所涉及的时间窗口中查询数据的时间戳所属的目标时间窗口。由于时间窗口基于时间窗口数组中的时间戳确定,因此可通过设定时间戳的方式,灵活配置时间窗口,提高了时间窗口配置的灵活性。此外,可在不进行时间戳转换的情况下确定出数据对应的时间窗口,提高了时间窗口的检测效率。In the method provided by the above-mentioned embodiments of the present application, by initializing a time window array including multiple time stamps located in the target time period, and using the time interval corresponding to each two adjacent time stamps as a time window, the data is received when the data is received. , the target time window to which the timestamp of the data belongs can be queried from the time windows involved in the time window array. Since the time window is determined based on the timestamps in the time window array, the time window can be flexibly configured by setting the timestamp, which improves the flexibility of the time window configuration. In addition, the time window corresponding to the data can be determined without performing timestamp conversion, which improves the detection efficiency of the time window.

需要说明的是,本申请实施例提供的时间窗口检测方法,执行主体可以为时间窗口检测装置,或者该时间窗口检测装置中的用于执行加载时间窗口检测方法的控制模块。本申请实施例中以时间窗口检测装置执行加载时间窗口检测方法为例,说明本申请实施例提供的时间窗口检测方法。It should be noted that, in the time window detection method provided by the embodiments of the present application, the execution subject 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 embodiments of the present application, the method for detecting a loading time window performed by a time window detecting device is used as an example to describe the method for detecting a time window provided by the embodiments of the present application.

如图5所示,本实施例上述的时间窗口检测装置500包括:初始化单元501,用于初始化时间窗口数组,上述时间窗口数组中包括位于目标时段内的多个时间戳,每两个相邻时间戳对应的时间区间作为一个时间窗口;查询单元502,用于在接收到待进行流量统计的数据时,从所述时间窗口数组中各相邻两时间戳对应的时间窗口中,查询所述数据的时间戳所属的目标时间窗口。As shown in FIG. 5 , the above-mentioned time window detection device 500 in this embodiment includes: an initialization unit 501 configured to initialize a time window array, wherein the time window array includes a plurality of time stamps located in the target period, and every two adjacent time stamps The time interval corresponding to the time stamp is used as a time window; the query unit 502 is configured to query the time window corresponding to each two adjacent time stamps in the time window array when receiving the data to be subjected to traffic statistics. The target time window to which the timestamp of the data belongs.

在本实施例的一些可选的实现方式中,上述初始化单元501,进一步用于基于当前时间确定目标时段;基于预设的间隔时长,选取上述目标时段内的多个时间戳;将上述多个时间戳按照时间先后顺序进行汇总,得到时间窗口数组。In some optional implementations of this embodiment, the above initialization unit 501 is further configured to determine a target time period based on the current time; select multiple time stamps in the above target time period based on a preset interval duration; The timestamps are aggregated in chronological order to obtain an array of time windows.

在本实施例的一些可选的实现方式中,上述查询单元502,进一步用于从上述时间窗口数组中,查询与上述数据的时间戳之差为正数且小于或等于上述间隔时长的目标时间戳,将初始化时间窗口中上述目标时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。In some optional implementations of this embodiment, the above query unit 502 is further configured to query, from the above time window array, a target time where the difference between the timestamps of the above data and the above data is a positive number and is less than or equal to the above interval duration The time window formed by the above target time stamp and the previous time stamp in the initialization time window is used as the target time window.

在本实施例的一些可选的实现方式中,上述查询单元502,进一步用于从上述时间窗口数组中,查询大于或等于上述数据的时间戳的最小时间戳,将初始化时间窗口中上述最小时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。In some optional implementations of this embodiment, the above query unit 502 is further configured to query the minimum time stamp greater than or equal to the time stamp of the above data from the above time window array, and initialize the above minimum time in the time window The time window formed by the timestamp and the previous timestamp is used as the target time window.

在本实施例的一些可选的实现方式中,上述装置还包括更新单元,用于在上述数据的时间戳大于上述时间窗口数组中的最大时间戳的情况下,基于当前时间更新上述目标时段,得到更新后的目标时段,并基于更新后的目标时段,更新上述时间窗口数组。In some optional implementations of this embodiment, the above-mentioned apparatus further includes an update unit, configured to update the above-mentioned target time period based on the current time when the time-stamp of the above-mentioned data is greater than the maximum time-stamp in the above-mentioned time window array, The updated target period is obtained, and based on the updated target period, the above-mentioned time window array is updated.

在本实施例的一些可选的实现方式中,上述装置还包括展示单元,用于确定各时间窗口对应的数据总量,并对各时间窗口对应的数据总量进行展示。In some optional implementations of this embodiment, the above-mentioned apparatus further includes a display unit, configured to determine the total amount of data corresponding to each time window, and display the total amount of data corresponding to each time window.

本申请实施例中的时间窗口检测装置可以是装置,也可以是终端中的部件、集成电路、或芯片。该装置可以是移动电子设备,也可以为非移动电子设备。示例性的,移动电子设备可以为手机、平板电脑、笔记本电脑、掌上电脑、车载电子设备、可穿戴设备、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本或者个人数字助理(personal digital assistant,PDA)等,非移动电子设备可以为服务器、网络附属存储器(Network Attached Storage,NAS)、个人计算机(personal computer,PC)、电视机(television,TV)、柜员机或者自助机等,本申请实施例不作具体限定。The time window detection device in this embodiment of the present application may be a device, or may be a component, an integrated circuit, or a chip in a terminal. The apparatus may be a mobile electronic device or a non-mobile electronic device. Exemplarily, the mobile electronic device may be a mobile phone, a tablet computer, a notebook computer, a palmtop computer, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (personal digital assistant). assistant, PDA), etc., the non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (personal computer, PC), a television (television, TV), a teller machine or a self-service machine, etc. This application Examples are not specifically limited.

本申请实施例中的时间窗口检测装置可以为具有操作系统的装置。该操作系统可以为安卓(Android)操作系统,可以为ios操作系统,还可以为其他可能的操作系统,本申请实施例不作具体限定。The time window detection device in the embodiment of the present application may be a device with an operating system. The operating system may be an Android (Android) operating system, an ios operating system, or other possible operating systems, which are not specifically limited in the embodiments of the present application.

本申请实施例提供的时间窗口检测装置能够实现图1的方法实施例中时间窗口检测装置实现的各个过程,为避免重复,这里不再赘述。The time window detection apparatus provided in this embodiment of the present application can implement each process implemented by the time window detection apparatus in the method embodiment of FIG. 1 , and to avoid repetition, details are not described here.

本申请的上述实施例提供的装置,通过初始化包含位于目标时段内的多个时间戳的时间窗口数组,并将每两个相邻时间戳对应的时间区间作为一个时间窗口,从而在接收到数据时,可从时间窗口数组所涉及的时间窗口中查询数据的时间戳所属的目标时间窗口。由于时间窗口基于时间窗口数组中的时间戳确定,因此可通过设定时间戳的方式,灵活配置时间窗口,提高了时间窗口配置的灵活性。此外,可在不进行时间戳转换的情况下确定出数据对应的时间窗口,提高了时间窗口的检测效率。In the device provided by the above-mentioned embodiments of the present application, by initializing a time window array including multiple time stamps located in the target time period, and using the time interval corresponding to each two adjacent time stamps as a time window, the data is received when data is received. , the target time window to which the timestamp of the data belongs can be queried from the time windows involved in the time window array. Since the time window is determined based on the timestamps in the time window array, the time window can be flexibly configured by setting the timestamp, which improves the flexibility of the time window configuration. In addition, the time window corresponding to the data can be determined without performing timestamp conversion, which improves the detection efficiency of the time window.

可选的,本申请实施例还提供一种电子设备,包括处理器610,存储器609,存储在存储器609上并可在所述处理器610上运行的程序或指令,该程序或指令被处理器610执行时实现上述时间窗口检测方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。Optionally, an embodiment of the present application further provides an electronic device, including a processor 610, a memory 609, a program or instruction stored in the memory 609 and executable on the processor 610, the program or instruction being processed by the processor When 610 is executed, each process of the foregoing time window detection method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, details are not described here.

需要注意的是,本申请实施例中的电子设备包括上述所述的移动电子设备和非移动电子设备。It should be noted that the electronic devices in the embodiments of the present application include the aforementioned mobile electronic devices and non-mobile electronic devices.

图6为实现本申请实施例的一种电子设备的硬件结构示意图。FIG. 6 is a schematic diagram of a hardware structure of an electronic device implementing an embodiment of the present application.

该电子设备600包括但不限于:射频单元601、网络模块602、音频输出单元603、输入单元604、传感器605、显示单元606、用户输入单元607、接口单元608、存储器609、以及处理器610等部件。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, and a processor 610, etc. part.

本领域技术人员可以理解,电子设备600还可以包括给各个部件供电的电源(比如电池),电源可以通过电源管理系统与处理器610逻辑相连,从而通过电源管理系统实现管理充电、放电、以及功耗管理等功能。图6中示出的电子设备结构并不构成对电子设备的限定,电子设备可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置,在此不再赘述。Those skilled in the art can understand that the electronic device 600 may also include a power source (such as a battery) for supplying power to various components, and the power source may be logically connected to the processor 610 through a power management system, so as to manage charging, discharging, and power management through the power management system. consumption management and other functions. The structure of the electronic device shown in FIG. 6 does not constitute a limitation on the electronic device, and the electronic device may include more or less components than those shown in the figure, or combine some components, or arrange different components, which will not be repeated here. .

其中,处理器610,用于时间窗口数组,所述时间窗口数组中包括位于目标时段内的多个时间戳,每两个相邻时间戳对应的时间区间作为一个时间窗口;在接收到待进行流量统计的数据时,从所述时间窗口数组中各相邻两时间戳对应的时间窗口中,查询所述数据的时间戳所属的目标时间窗口。Wherein, the processor 610 is used for a time window array, the time window array includes a plurality of time stamps located in the target time period, and the time interval corresponding to each two adjacent time stamps is used as a time window; In the case of traffic statistics data, the target time window to which the time stamp of the data belongs is queried from the time windows corresponding to two adjacent time stamps in the time window array.

在本申请实施例中,通过初始化包含位于目标时段内的多个时间戳的时间窗口数组,并将每两个相邻时间戳对应的时间区间作为一个时间窗口,从而在接收到待进行流量统计的数据时,从时间窗口数组中各相邻两时间戳对应的时间窗口中,查询上述数据的时间戳所属的目标时间窗口。由于时间窗口基于时间窗口数组中的时间戳确定,因此可通过设定时间戳的方式,灵活配置时间窗口,提高了时间窗口配置的灵活性。此外,可在不进行时间戳转换的情况下确定出数据对应的时间窗口,提高了时间窗口的检测效率。In this embodiment of the present application, by initializing a time window array including multiple time stamps within the target time period, and using the time interval corresponding to every two adjacent time stamps as a time window, traffic statistics to be performed after receiving When the data is stored, the target time window to which the time stamp of the above data belongs is queried from the time windows corresponding to two adjacent time stamps in the time window array. Since the time window is determined based on the timestamps in the time window array, the time window can be flexibly configured by setting the timestamp, which improves the flexibility of the time window configuration. In addition, the time window corresponding to the data can be determined without performing timestamp conversion, which improves the detection efficiency of the time window.

可选的,处理器610,还用于基于当前时间确定目标时段;基于预设的间隔时长,选取所述目标时段内的多个时间戳;将所述多个时间戳按照时间先后顺序进行汇总,得到时间窗口数组。Optionally, the processor 610 is further configured to determine a target period based on the current time; select multiple timestamps in the target period based on a preset interval duration; and summarize the multiple timestamps in chronological order. , to get an array of time windows.

可选的,处理器610,还用于从所述时间窗口数组中,查询与所述数据的时间戳之差为正数且小于或等于所述间隔时长的目标时间戳,将初始化时间窗口中所述目标时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。Optionally, the processor 610 is further configured to, from the time window array, query for a target time stamp whose difference between the time stamps of the data and the data is a positive number and is less than or equal to the interval duration, and store the data in the initialization time window. The time window formed by the target time stamp and the previous time stamp is used as the target time window.

可选的,处理器610,还用于从所述时间窗口数组中,查询大于或等于所述数据的时间戳的最小时间戳,将初始化时间窗口中所述最小时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。Optionally, the processor 610 is further configured to query the minimum timestamp greater than or equal to the timestamp of the data from the time window array, and compare the minimum timestamp in the initialization time window with the previous timestamp. The constituted time window is used as the target time window.

可选的,处理器610,还用于在所述数据的时间戳大于所述时间窗口数组中的最大时间戳的情况下,基于当前时间更新所述目标时段,得到更新后的目标时段,并基于更新后的目标时段,更新所述时间窗口数组。Optionally, the processor 610 is further configured to update the target period based on the current time when the timestamp of the data is greater than the maximum timestamp in the time window array to obtain an updated target period, and Based on the updated target period, the time window array is updated.

可选的,处理器610,还用于确定各时间窗口对应的数据总量,并控制显示单元606对各时间窗口对应的数据总量进行展示。Optionally, the processor 610 is further configured to determine the 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.

应理解的是,本申请实施例中,输入单元604可以包括图形处理器(GraphicsProcessing Unit,GPU)6041和麦克风6042,图形处理器6041对在视频捕获模式或图像捕获模式中由图像捕获装置(如摄像头)获得的静态图片或视频的图像数据进行处理。显示单元606可包括显示面板6061,可以采用液晶显示器、有机发光二极管等形式来配置显示面板6061。用户输入单元607包括触控面板6071以及其他输入设备6072。触控面板6071,也称为触摸屏。触控面板6071可包括触摸检测装置和触摸控制器两个部分。其他输入设备6072可以包括但不限于物理键盘、功能键(比如音量控制按键、开关按键等)、轨迹球、鼠标、操作杆,在此不再赘述。存储器609可用于存储软件程序以及各种数据,包括但不限于应用程序和操作系统。处理器610可集成应用处理器和调制解调处理器,其中,应用处理器主要处理操作系统、用户界面和应用程序等,调制解调处理器主要处理无线通信。可以理解的是,上述调制解调处理器也可以不集成到处理器610中。It should be understood that, in this embodiment of the present application, the input unit 604 may include a graphics processor (Graphics Processing Unit, GPU) 6041 and a microphone 6042. camera) to process the image data of still pictures or videos. The display unit 606 may include a display panel 6061, which 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 . The touch panel 6071 is also called a touch screen. The touch panel 6071 may include two parts, a touch detection device and a touch controller. Other input devices 6072 may include, but are not limited to, physical keyboards, function keys (such as volume control keys, switch keys, etc.), trackballs, mice, and joysticks, which are not described herein again. Memory 609 may be used to store software programs as well as various data, including but not limited to application programs and operating systems. The processor 610 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and an application program, and the like, and the modem processor mainly processes wireless communication. It can be understood that, the above-mentioned modulation and demodulation processor may not be integrated into the processor 610.

本申请实施例还提供一种可读存储介质,所述可读存储介质上存储有程序或指令,该程序或指令被处理器执行时实现上述时间窗口检测方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。The embodiments of the present application further provide a readable storage medium, where a program or an instruction is stored on the readable storage medium, and when the program or instruction is executed by a processor, each process of the foregoing time window detection method embodiment can be achieved, and can achieve The same technical effect, in order to avoid repetition, will not be repeated here.

其中,所述处理器为上述实施例中所述的电子设备中的处理器。所述可读存储介质,包括计算机可读存储介质,如计算机只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等。Wherein, the processor is the processor in the electronic device described in the foregoing embodiments. The readable storage medium includes a computer-readable storage medium, such as a computer read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, and the like.

本申请实施例另提供了一种芯片,所述芯片包括处理器和通信接口,所述通信接口和所述处理器耦合,所述处理器用于运行程序或指令,实现上述时间窗口检测方法实施例的各个过程,且能达到相同的技术效果,为避免重复,这里不再赘述。An 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 the above-mentioned embodiment of the time window detection method and can achieve the same technical effect, in order to avoid repetition, it will not be repeated here.

应理解,本申请实施例提到的芯片还可以称为系统级芯片、系统芯片、芯片系统或片上系统芯片等。It should be understood that the chip mentioned in the embodiments of the present application may also be referred to as a system-on-chip, a system-on-chip, a system-on-a-chip, or a system-on-a-chip, or the like.

需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。此外,需要指出的是,本申请实施方式中的方法和装置的范围不限按示出或讨论的顺序来执行功能,还可包括根据所涉及的功能按基本同时的方式或按相反的顺序来执行功能,例如,可以按不同于所描述的次序来执行所描述的方法,并且还可以添加、省去、或组合各种步骤。另外,参照某些示例所描述的特征可在其他示例中被组合。It should be noted that, herein, the terms "comprising", "comprising" or any other variation thereof are intended to encompass non-exclusive inclusion, such that a process, method, article or device comprising a series of elements includes not only those elements, It also includes other elements not expressly listed or inherent to such a process, method, article or apparatus. Without further limitation, an element qualified by the phrase "comprising a..." does not preclude the presence of additional identical elements in a process, method, article or apparatus that includes the element. Furthermore, it should be noted that the scope of the methods and apparatus in the embodiments of the present application is not limited to performing the functions in the order shown or discussed, but may also include performing the functions in a substantially simultaneous manner or in the reverse order depending on the functions involved. To perform functions, for example, the described methods may be performed in an order different from that described, and various steps may also be added, omitted, or combined. Additionally, features described with reference to some examples may be combined in other examples.

通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of this application.

上面结合附图对本申请的实施例进行了描述,但是本申请并不局限于上述的具体实施方式,上述的具体实施方式仅仅是示意性的,而不是限制性的,本领域的普通技术人员在本申请的启示下,在不脱离本申请宗旨和权利要求所保护的范围情况下,还可做出很多形式,均属于本申请的保护之内。The embodiments of the present application have been described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific embodiments, which are merely illustrative rather than restrictive. Under the inspiration of this application, without departing from the scope of protection of the purpose of this application and the claims, many forms can be made, which all fall within the protection of this application.

Claims (10)

1.一种时间窗口检测方法,其特征在于,所述方法包括:1. a time window detection method, is characterized in that, described method comprises: 初始化时间窗口数组,所述时间窗口数组中包括位于目标时段内的多个时间戳,每两个相邻时间戳对应的时间区间作为一个时间窗口;Initializing a time window array, the time window array includes a plurality of time stamps located in the target time period, and the time interval corresponding to each two adjacent time stamps is used as a time window; 在接收到待进行流量统计的数据时,从所述时间窗口数组中各相邻两时间戳对应的时间窗口中,查询所述数据的时间戳所属的目标时间窗口。When the data to be counted is received, the target time window to which the time stamp of the data belongs is queried from the time windows corresponding to two adjacent time stamps in the time window array. 2.根据权利要求1所述的方法,其特征在于,所述初始化时间窗口数组,包括:2. The method according to claim 1, wherein the initialization time window array comprises: 基于当前时间确定目标时段;Determine the target period based on the current time; 基于预设的间隔时长,选取所述目标时段内的多个时间戳;Selecting multiple timestamps within the target period based on a preset interval duration; 将所述多个时间戳按照时间先后顺序进行汇总,得到时间窗口数组。The multiple timestamps are aggregated in chronological order to obtain a time window array. 3.根据权利要求2所述的方法,其特征在于,所述从所述时间窗口数组中各相邻两时间戳对应的时间窗口中,查询所述数据的时间戳所属的目标时间窗口,包括:3. The method according to claim 2, characterized in that, in the time window corresponding to each two adjacent time stamps in the time window array, querying the target time window to which the time stamp of the data belongs, comprising: : 从所述时间窗口数组中,查询与所述数据的时间戳之差为正数且小于或等于所述间隔时长的目标时间戳,将所述时间窗口数组中所述目标时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。From the time window array, query the target timestamp whose difference between the timestamps of the data and the data is a positive number and less than or equal to the interval duration, and compare the target timestamp in the time window array with the previous time The time window formed by the stamp is used as the target time window. 4.根据权利要求1所述的方法,其特征在于,所述从所述时间窗口数组中各相邻两时间戳对应的时间窗口中,查询所述数据的时间戳所属的目标时间窗口,包括:4. The method according to claim 1, wherein, in the time window corresponding to each two adjacent time stamps in the time window array, querying the target time window to which the time stamp of the data belongs, comprising: : 从所述时间窗口数组中,查询大于或等于所述数据的时间戳的最小时间戳,将所述时间窗口中所述最小时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。From the time window array, query the minimum timestamp greater than or equal to the timestamp of the data, and use the time window formed by the minimum timestamp and the previous timestamp in the time window as the target time window. 5.根据权利要求1所述的方法,其特征在于,所述方法还包括:5. The method according to claim 1, wherein the method further comprises: 在所述数据的时间戳大于所述时间窗口数组中的最大时间戳的情况下,基于当前时间更新所述目标时段,得到更新后的目标时段,并基于所述更新后的目标时段,更新所述时间窗口数组。In the case where the timestamp of the data is greater than the maximum timestamp in the time window array, the target period is updated based on the current time to obtain an updated target period, and based on the updated target period, the target period is updated. The array of time windows described. 6.一种时间窗口检测装置,其特征在于,所述装置包括:6. A time window detection device, wherein the device comprises: 初始化单元,用于初始化时间窗口数组,所述时间窗口数组中包括位于目标时段内的多个时间戳,每两个相邻时间戳对应的时间区间作为一个时间窗口;an initialization unit, used to initialize a time window array, the time window array includes a plurality of time stamps located in the target time period, and the time interval corresponding to each two adjacent time stamps is used as a time window; 查询单元,用于在接收到待进行流量统计的数据时,从所述时间窗口数组中各相邻两时间戳对应的时间窗口中,查询所述数据的时间戳所属的目标时间窗口。The query unit is configured to query, from the time windows corresponding to two adjacent time stamps in the time window array, the target time window to which the time stamp of the data belongs, when the data to be counted is received. 7.根据权利要求1所述的装置,其特征在于,所述初始化单元,进一步用于:7. The apparatus according to claim 1, wherein the initialization unit is further configured to: 基于当前时间确定目标时段;Determine the target period based on the current time; 基于预设的间隔时长,选取所述目标时段内的多个时间戳;Selecting multiple timestamps within the target period based on a preset interval duration; 将所述多个时间戳按照时间先后顺序进行汇总,得到时间窗口数组。The multiple timestamps are aggregated in chronological order to obtain a time window array. 8.根据权利要求7所述的装置,其特征在于,所述查询单元,进一步用于:8. The device according to claim 7, wherein the query unit is further configured to: 从所述时间窗口数组中,查询与所述数据的时间戳之差为正数且小于或等于所述间隔时长的目标时间戳,将所述时间窗口数组中所述目标时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。From the time window array, query the target timestamp whose difference between the timestamps of the data and the data is a positive number and less than or equal to the interval duration, and compare the target timestamp in the time window array with the previous time The time window formed by the stamp is used as the target time window. 9.根据权利要求6所述的装置,其特征在于,所述查询单元,进一步用于:9. The apparatus according to claim 6, wherein the query unit is further configured to: 从所述时间窗口数组中,查询大于或等于所述数据的时间戳的最小时间戳,将所述时间窗口中所述最小时间戳与前一时间戳所构成的时间窗口作为目标时间窗口。From the time window array, query the minimum timestamp greater than or equal to the timestamp of the data, and use the time window formed by the minimum timestamp and the previous timestamp in the time window as the target time window. 10.根据权利要求6所述的装置,其特征在于,所述装置还包括:10. The apparatus of claim 6, wherein the apparatus further comprises: 更新单元,用于在所述数据的时间戳大于所述时间窗口数组中的最大时间戳的情况下,基于当前时间更新所述目标时段,得到更新后的目标时段,并基于所述更新后的目标时段,更新所述时间窗口数组。The updating unit is configured to update the target period based on the current time when the timestamp of the data is greater than the maximum timestamp in the time window array to obtain the updated target period, and based on the updated target period Target period, update 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 (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100815866B1 (en) * 2007-01-25 2008-03-24 인하대학교 산학협력단 Timestamp-Based Sampling Method of Data Streams
CN102479189A (en) * 2010-11-23 2012-05-30 上海宝信软件股份有限公司 Indexing method for high-speed uniform access of mass timestamp data in memory
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
CN110532307A (en) * 2019-07-11 2019-12-03 北京大学 A kind of date storage method and querying method flowing sliding window
CN110943796A (en) * 2019-11-19 2020-03-31 深圳市道通智能航空技术有限公司 Timestamp alignment method, timestamp alignment device, storage medium and equipment

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100815866B1 (en) * 2007-01-25 2008-03-24 인하대학교 산학협력단 Timestamp-Based Sampling Method of Data Streams
CN102479189A (en) * 2010-11-23 2012-05-30 上海宝信软件股份有限公司 Indexing method for high-speed uniform access of mass timestamp data in memory
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
CN110532307A (en) * 2019-07-11 2019-12-03 北京大学 A kind of date storage method and querying method flowing sliding window
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
WO2019128546A1 (en) Application program processing method, electronic device, and computer readable storage medium
US10893113B2 (en) Generating push notifications
WO2022161325A1 (en) Prompting method and electronic device
WO2019024646A1 (en) Application management and control method, apparatus, and electronic device
CN113765873A (en) Method and apparatus for detecting abnormal access traffic
CN113259221A (en) Message display method and device and electronic equipment
CN107450952B (en) Application control method and device, storage medium and electronic equipment
CN113051493A (en) Application program display method and device, storage medium and terminal
CN111866071A (en) Data uploading method and device of business application, electronic equipment and storage medium
CN106648916B (en) Method and device for reporting pedometer message
CN114328676A (en) Time window detection method and device
CN111274104B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN108536512B (en) Interface switching method and device and terminal equipment
CN109992369B (en) Application program processing method and device, electronic equipment and computer readable storage medium
CN113923254B (en) Method and device for determining connection state of equipment, electronic equipment and medium
CN116545905A (en) Service health detection method and device, electronic equipment and storage medium
CN112770415B (en) Information processing method and device for wireless hotspot
CN111190897B (en) Information processing method, information processing apparatus, storage medium, and server
CN112099857B (en) Dormancy awakening method of electronic equipment and electronic equipment
CN114884724B (en) Cloud server interaction method and device, readable storage medium and terminal equipment
CN113268300B (en) Information display method and device
CN113589916B (en) Memory control method and device
CN112732326B (en) Information display method and device
CN113722575B (en) A method for information query and related device
US20240394187A1 (en) Multi-tier memory reclamation

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