WO2012083708A1 - 一种统计方法及装置 - Google Patents

一种统计方法及装置 Download PDF

Info

Publication number
WO2012083708A1
WO2012083708A1 PCT/CN2011/078544 CN2011078544W WO2012083708A1 WO 2012083708 A1 WO2012083708 A1 WO 2012083708A1 CN 2011078544 W CN2011078544 W CN 2011078544W WO 2012083708 A1 WO2012083708 A1 WO 2012083708A1
Authority
WO
WIPO (PCT)
Prior art keywords
counter
cache
computer instruction
address
stored
Prior art date
Application number
PCT/CN2011/078544
Other languages
English (en)
French (fr)
Inventor
薛蕴全
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2011/078544 priority Critical patent/WO2012083708A1/zh
Priority to CN201180001433.3A priority patent/CN102388360B/zh
Publication of WO2012083708A1 publication Critical patent/WO2012083708A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/88Monitoring involving counting

Definitions

  • Embodiments of the present invention relate to computer technologies, and in particular, to a statistical method and apparatus.
  • Counting by variables in the communication software is the main way to achieve counting.
  • the feature of this scheme is to define the counter as a variable or an array. When counting is required, an accumulation operation is performed on the variable, or an accumulation operation is performed on the array member.
  • the embodiment of the invention provides a statistical method and device.
  • the computer program does not need to be run, the counting efficiency is improved, and the burden on the processor is reduced.
  • a statistical method provided by an embodiment of the present invention includes:
  • a statistical apparatus provided by an embodiment of the present invention includes:
  • An execution unit configured to execute a first computer instruction
  • An accumulating unit configured to: when the first computer instruction has a corresponding first counter address, add a value of the first counter; wherein the first computer instruction and the first counter address are stored in a process In the cache.
  • FIG. 2 is a schematic diagram of information stored in a cache according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram of another cache storage information according to an embodiment of the present invention
  • FIG. 4 is a statistical apparatus according to an embodiment of the present invention
  • Embodiment 1 is a diagrammatic representation of Embodiment 1:
  • FIG. 1 is a flowchart of a statistical method provided by an embodiment of the present invention, where the method includes:
  • the processor may perform multiple implementations of the first computer instruction, and the invention is not specifically limited.
  • the address register (AR) will be the first computer instruction.
  • the address is sent to the cache (cache) via the address bus.
  • the first computer instruction fetched from the cache by the instruction pipeline is sent to the Instruction Register (IR).
  • An Instruction Decoder (ID) decodes the first computer instruction.
  • the processor issues various control information required to execute the first computer instruction through the control circuit.
  • the first computer instruction is executed by the above steps.
  • the value of the first counter is incremented by one.
  • the first computer instruction and the first counter address are stored in a cache cache of the processor.
  • the first counter is used to count the number of executions of the first computer instruction.
  • the first computer instruction triggers the value of the first counter by one through the hardware circuit of the processor.
  • the first computer command can trigger the value of the first counter to increase by one by a trigger signal.
  • the trigger signal can be a status flag generated during execution of the first computer instruction.
  • the trigger signal can be a write back status flag or a retire flag of the first computer instruction.
  • the prior art implements statistics on the number of executions of computer instructions through software. Adding code for counting the number of executions of computer instructions, such as counting functions, in a computer program reduces computer program performance. First, the counting function needs to occupy a certain amount of storage space, which causes the computer program to occupy more storage space. Second, repeatedly calling the counting function will prolong the execution time of the computer program.
  • the statistical method proposed by the embodiment of the present invention counts the number of executions of the computer instruction, the computer program does not need to be run, the counting efficiency is improved, and the burden on the processor is reduced.
  • the first counter address is stored in the cache cache of the processor.
  • the first counter address is stored in a counter address space corresponding to the first computer instruction in the cache, where the cache reserves a corresponding address for each computer instruction. Counter address space.
  • the computer instructions may be stored in the cache in the form of a sequence of instructions.
  • Count The address of the device can be stored in the cache as a sequence of addresses.
  • the storage space occupied by the computer instruction may be equal to the storage space occupied by the counter address. For example, when a computer instruction occupies 4 bytes of storage space, 256K computer instructions occupy 1 Mbyte of storage space.
  • the counter address space reserved in the cache is also 1 Mbyte. This scheme can count the number of executions of each computer instruction.
  • the value of the first counter plus one specifically includes: when the first computer instruction is stored in the offset address of the cache, and the X bit is equal to the first associated information.
  • the value of the first counter is incremented by 1, wherein the first computer instruction stores the offset address of the cache as Y bits, and Y is greater than or equal to X.
  • the first computer instruction and the first counter for counting the number of executions of the first computer instruction may be determined by the first associated information stored in the cache. Since the information stored in the cache can be updated, different first computer instructions can be determined for the first counter address by updating the first associated information stored in the cache.
  • the address of the computer instruction stored in the cache can be represented by the base address plus the offset address.
  • the offset address occupies relatively little storage space, and the first associated information is equal to the last X bits of the offset address of the first computer instruction stored in the cache, so the first associated information occupies relatively little storage space.
  • FIG. 2 is a schematic diagram of computer instructions, computer instructions stored in the cache offset address, counter address, and associated information stored in the cache.
  • the number of bits of the offset address is 2.
  • the offset addresses of instruction one, instruction two, instruction three, and instruction four are binary numbers 00, 01, 10, and 1 1, respectively.
  • the associated information is 2 bits.
  • the association information may be any one of binary numbers 00, 01, 10, and 11.
  • the first computer instruction stores the offset address of the cache equal to the first associated information.
  • Instruction 1, instruction two, instruction three and instruction four have a counter address, that is, counter address one.
  • the instruction one, the instruction two, the instruction three and the instruction four have one associated information, that is, the associated information one. turn off
  • the joint information determines which of the four instructions is the first computer instruction. For example, when the associated information is binary 01, the second instruction is the first computer instruction. When the associated information is 10, the third instruction is the first computer instruction.
  • the number of computer instructions stored in the cache is M, M is a natural number, the quotient of M and 2 X is P, and the remainder is Q;
  • each associated information has a length of X bits, and each associated information is equal to a corresponding computer instruction stored in the cache. Move the last X bits of the address.
  • the number of counters in the processor is limited, and determining a counter for all computer instructions stored in the cache will consume a large amount of counter resources. In general, it is not necessary to count the number of executions of each computer instruction.
  • the above scheme can save counter resources.
  • the counter is represented by the address of the counter stored in the cache, so the above scheme can save storage space of the cache.
  • the number of computer instructions stored in the cache is 8.
  • the number of bits of the offset address of the computer instruction is 2.
  • the number of bits of the associated information is 2.
  • the quotient of 8 and 2 2 is 2, and the remainder is 0.
  • the number of counters used to count the number of executions of computer instructions is two.
  • the number of computer instructions stored in the cache is 9.
  • the number of bits of the offset address of the computer instruction is 2.
  • the number of bits of the associated information is 2.
  • the quotient of 9 and 2 2 is 2, and the remainder is 1.
  • the number of counters used to count the number of executions of computer instructions is three.
  • the value of the first counter plus one specifically includes:
  • the value of the first counter is incremented by one, and the trigger signal is a status flag generated during execution of the first computer instruction.
  • the trigger signal is a write back status flag or an active status flag of the first computer instruction.
  • Figure 4 is a schematic diagram of a statistical apparatus provided by an embodiment of the present invention.
  • the device includes:
  • the executing unit 401 is configured to execute the first computer instruction.
  • the processor may perform multiple implementations of the first computer instruction, which is not specifically limited by the present invention.
  • the AR sends the address of the first computer instruction to the cache through the address bus.
  • the first computer instruction taken by the instruction pipeline from the cache is sent to the IR.
  • the ID decodes the first computer instruction.
  • the processor issues various control information required to execute the first computer command through the control circuit.
  • the first computer instruction is executed through the above steps.
  • the accumulating unit 402 is configured to: when the first computer instruction has a corresponding first counter address, add a value of the first counter; wherein the first computer instruction and the first counter address are stored in a cache of the processor.
  • the first counter is used to count the number of executions of the first computer instruction.
  • the first computer instruction triggers the value of the first counter by one through the hardware circuit of the processor.
  • the first computer command can trigger the value of the first counter to increase by one by a trigger signal.
  • the trigger signal can be a status flag generated during execution of the first computer instruction.
  • the trigger signal can be a write back status flag or a retire status flag of the first computer instruction.
  • the prior art implements statistics on the number of executions of computer instructions through software. Adding code for counting the number of executions of computer instructions, such as counting functions, in a computer program reduces computer program performance. First, the counting function needs to occupy a certain amount of storage space, causing the computer program to occupy more storage space. Second, repeatedly calling the counting function will prolong the execution time of the computer program.
  • the statistical device proposed by the embodiment of the present invention counts the number of executions of the computer instruction, the computer program does not need to be run, the counting efficiency is improved, and the burden on the processor is reduced.
  • the accumulating unit specifically includes a comparing unit and a counting unit, and the comparing unit is configured to send a trigger signal to the counting unit when the first computer instruction is stored in the offset address of the cache, and the X bit is equal to the first associated information;
  • the counting unit is configured to: when the trigger signal is received, the value of the first counter is increased by 1;
  • the first computer instruction stores the offset address of the cache as Y bits, and Y is greater than X.
  • the first computer instruction and the first counter for counting the number of executions of the first computer instruction may be determined by the first associated information stored in the cache. Since the information stored in the cache can be updated, different first computer instructions can be determined for the first counter address by updating the first associated information stored in the cache.
  • the address of the computer instruction stored in the cache can be represented by the base address plus the offset address.
  • the offset address occupies relatively little storage space, and the first associated information is equal to the last X bits of the offset address of the first computer instruction stored in the cache, so the first associated information occupies relatively little storage space.
  • FIG. 2 is a schematic diagram of computer instructions, computer instructions stored in the cache offset address, counter address, and associated information stored in the cache.
  • the number of bits of the offset address is 2.
  • the offset addresses of instruction one, instruction two, instruction three, and instruction four are binary numbers 00, 01, 10, and 11, respectively.
  • the associated information is 2 bits.
  • the association information may be any one of binary numbers 00, 01, 10, and 11.
  • the first computer instruction stores the offset address of the cache equal to the first associated information.
  • Instruction 1, instruction two, instruction three and instruction four have a counter address, that is, counter address one.
  • the instruction one, the instruction two, the instruction three and the instruction four have one associated information, that is, the associated information one.
  • the associated information determines which of the four instructions is the first computer instruction. For example, when the associated information is binary 01, the second instruction is the first computer instruction. When the associated information is 10, the instruction three is the first A computer instruction.

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Description

一种统计方法及装置 技术领域 本发明实施例涉及计算机技术, 尤其涉及一种统计方法及装置。
背景技术 通信领域存在许多需要进行计数的场景。 例如, 对出接口转发的报文的 个数进行统计; 对由于报文头部校验出现错误而丟弃的报文的个数进行统计 等。
通过通信软件中的变量进行计数, 是实现计数的主要方式。 该方案的特 点是, 将计数器定义为变量或数组。 需要计数时, 在变量上执行累加操作, 或者在数组成员上执行累加操作。
发明人发现, 现有技术存在以下技术问题:
通过软件中的变量进行计数, 需要运行计算机程序, 降低了计数的效率 并增加了处理器的负担。
发明内容
本发明实施例提供一种统计方法及装置, 对计算机指令的执行次数进行 统计时, 不需要运行计算机程序, 提高了计数的效率, 降低了处理器的负担。
一方面, 本发明实施例提供的一种统计方法, 包括:
执行第一计算机指令;
当该第一计算机指令有对应的第一计数器地址, 则该第一计数器的值加
1; 其中该第一计算机指令和该第一计数器地址存储在处理器的高速緩存 cache中。
另一方面, 本发明实施例提供的一种统计装置, 包括:
执行单元, 用于执行第一计算机指令;
累加单元, 用于当该第一计算机指令有对应的第一计数器地址, 则该第 一计数器的值加 1 ; 其中该第一计算机指令和该第一计数器地址存储在处理 器的 cache中。
可见, 通过本发明实施例提出的统计方法及装置, 对计算机指令的执行 次数进行统计时, 不需要运行计算机程序, 提高了计数的效率, 降低了处理 器的负担。
附图说明 为了更清楚地说明本发明实施例或现有技术中的技术方案, 下面将对实 施例或现有技术描述中所需要使用的附图作一简单地介绍, 显而易见地, 下 面描述中的附图是本发明的一些实施例, 对于本领域普通技术人员来讲, 在 不付出创造性劳动的前提下, 还可以根据这些附图获得其他的附图。
图 1是本发明实施例提供的统计方法流程图;
图 2是本发明实施例提供的一种高速緩存存储的信息的示意图; 图 3是本发明实施例提供的另一种高速緩存存储的信息的示意图; 图 4是本发明实施例提供的统计装置示意图。
具体实肺式 为使本发明实施例的目的、 技术方案和优点更加清楚, 下面将结合本发 明实施例中的附图, 对本发明实施例中的技术方案进行清楚、 完整地描述, 显然, 所描述的实施例是本发明一部分实施例, 而不是全部的实施例。 基于 本发明中的实施例, 本领域普通技术人员在没有作出创造性劳动前提下所获 得的所有其他实施例, 都属于本发明保护的范围。
实施例一:
本发明实施例提供了一种统计方法, 参见图 1, 图 1是本发明实施例提 供的一种统计方法流程图, 该方法包括:
101 : 执行第一计算机指令。
具体实现时, 处理器执行第一计算机指令可以有多种实现方式, 本发明 不做具体的限定。 例如程序计数器 (program counter, PC )计算出第一计算 机指令的地址后, 地址寄存器(Address Register, AR )将第一计算机指令的 地址通过地址总线送至高速緩存(cache ) 。 指令流水线从 cache取出的第一 计算机指令送至指令寄存器( Instruction Register, IR )。指令译码器( Instruction Decoder, ID )对第一计算机指令进行译码。 译码后处理器通过控制电路发出 执行第一计算机指令所需要的各种控制信息。 通过以上步骤第一计算机指令 被执行。
102: 当该第一计算机指令有对应的第一计数器地址, 则该第一计数器的 值加 1。 其中该第一计算机指令和该第一计数器地址存储在处理器的高速緩 存 cache中。
第一计数器用于对第一计算机指令的执行次数进行统计。
第一计数器的值加 1具体实现时, 可以是第一计算机指令通过处理器的 硬件电路触发第一计数器的值加 1。 第一计算机指令可以通过触发信号触发 第一计数器的值加 1。 触发信号可以是执行该第一计算机指令过程中产生的 状态标志。 例如, 触发信号可以是第一计算机指令的写回 (write back )状态 标志或者生效 ( retire ) 夫态标志。
现有技术通过软件实现对计算机指令执行次数进行统计。 在计算机程序 中增加用于对计算机指令执行次数进行统计的代码, 例如计数函数, 降低了 计算机程序性能。 其一、 计数函数需要占用一定的存储空间, 导致计算机程 序占用更多的存储空间。 其二、 反复调用计数函数, 将延长计算机程序执行 的时间。
通过本发明实施例提出的统计方法, 对计算机指令的执行次数进行统计 时, 不需要运行计算机程序, 提高了计数的效率, 降低了处理器的负担。
可选的,
该第一计数器地址存储在处理器的高速緩存 cache 中具体为: 该第一计 数器地址存储在 cache 中该第一计算机指令对应的计数器地址空间中, 其中 该 cache为每个计算机指令预留对应的计数器地址空间。
具体实现时, 计算机指令可以以指令序列的方式存储在 cache 中。 计数 器地址可以以地址序列的方式存储在 cache 中。 每个计算机指令对应一个预 留的计数器地址空间具体实现时, 计算机指令占用的存储空间可以等于计数 器地址占用的存储空间。 例如, 当一个计算机指令占用 4字节的存储空间时, 256K个计算机指令占用 1M字节的存储空间。 当一个计数器地址占用 4字节 的存储空间时, cache中预留的计数器地址空间也是 1M字节。 该方案可以对 每个计算机指令的执行次数进行统计。
可选的,
当该第一计算机指令有对应的第一计数器地址, 则该第一计数器的值加 1具体包括: 当该第一计算机指令存储在该 cache的偏移地址的后 X比特等 于第一关联信息时, 则该第一计数器的值加 1, 其中该第一计算机指令存储 在该 cache的偏移地址为 Y比特, Y大于等于 X。
可以通过 cache 中存储的第一关联信息确定第一计算机指令以及用于统 计第一计算机指令执行次数的第一计数器。 由于 cache 中存储的信息可以被 更新, 因此可以通过更新 cache 中存储的第一关联信息为第一计数器地址确 定不同的第一计算机指令。
具体实现时, 计算机指令存储在 cache 的地址可以用基地址加偏移地址 表示。 偏移地址占用的存储空间相对较少, 第一关联信息等于第一计算机指 令存储在 cache的偏移地址的后 X比特, 因此第一关联信息占用的存储空间 相对较少。
参见图 2, 图 2为计算机指令、 计算机指令存储在 cache的偏移地址、 计 数器地址以及关联信息存储在 cache的示意图。 偏移地址的比特数为 2。 指令 一、 指令二、 指令三以及指令四的偏移地址分别是二进制数 00、 01、 10以及 1 1。 关联信息为 2比特。 关联信息可以是二进制数 00、 01、 10以及 1 1中的 任意一个。 第一计算机指令存储在 cache 的偏移地址等于第一关联信息。 指 令一、 指令二、 指令三以及指令四共有一个计数器地址, 即计数器地址一。 指令一、 指令二、 指令三以及指令四共有一个关联信息, 即关联信息一。 关 联信息一确定四条指令中哪条指令是第一计算机指令。 例如, 当关联信息是 二进制 01时, 指令二是第一计算机指令。 当关联信息为 10时, 指令三是第 一计算机指令。
可选的,
该 cache中存储的计算机指令的个数为 M, M为自然数, M与 2X的商数 为 P, 余数为 Q;
当 Q为 0时, 该 cache中存储的计数器地址的个数为 P, 有 P个关联信 息, 每个关联信息的长度为 X比特, 每个关联信息等于对应的计算机指令存 储在该 cache的偏移地址的后 X比特。
实践中, 处理器中计数器的个数是有限的, 为所有存储在 cache 中的计 算机指令分别确定一个计数器将占用大量计数器资源。 一般情况下, 对每个 计算机指令的执行次数都进行统计是没有必要的。 上述方案可以节省计数器 资源。 另外, 计数器用存储在 cache 中的计数器的地址表示, 因此, 上述方 案可以节省 cache的存储空间。
参见图 2, cache中存储的计算机指令个数为 8。 计算机指令的偏移地址 的比特数为 2。 关联信息的比特数为 2。 8与 22的商数为 2, 余数为 0。 用于 统计计算机指令执行次数的计数器的个数为 2。
可选的,
当 Q不为 0时, 该 cache中存储的计数器地址的个数为 P+l。
参见图 3, cache中存储的计算机指令个数为 9。 计算机指令的偏移地址 的比特数为 2。 关联信息的比特数为 2。 9与 22的商数为 2, 余数为 1。 用于 统计计算机指令执行次数的计数器的个数为 3。
可选的,
该第一计数器的值加 1具体包括:
接收触发信号, 该第一计数器的值加 1, 该触发信号为执行该第一计算 机指令过程中产生的状态标志。 可选的,
该触发信号为该第一计算机指令的写回状态标志或者生效状态标志。 实施例二:
本发明实施例提供了一种统计装置。 参见图 4, 图 4是本发明实施例提 供的统计装置示意图。 该装置包括:
执行单元 401, 用于执行第一计算机指令。
具体实现时, 处理器执行第一计算机指令可以有多种实现方式, 本发明 不做具体的限定。 例如 PC计算出第一计算机指令的地址后, AR将第一计 算机指令的地址通过地址总线送至 cache。 指令流水线从 cache取出的第一计 算机指令送至 IR。 ID对第一计算机指令进行译码。译码后处理器通过控制电 路发出执行第一计算机指令所需要的各种控制信息。 通过以上步骤第一计算 机指令被执行。
累加单元 402, 用于当该第一计算机指令有对应的第一计数器地址, 则 该第一计数器的值加 1 ; 其中该第一计算机指令和该第一计数器地址存储在 处理器的 cache中。
第一计数器用于对第一计算机指令的执行次数进行统计。
第一计数器的值加 1具体实现时, 可以是第一计算机指令通过处理器的 硬件电路触发第一计数器的值加 1。 第一计算机指令可以通过触发信号触发 第一计数器的值加 1。 触发信号可以是执行该第一计算机指令过程中产生的 状态标志。例如,触发信号可以是第一计算机指令的 write back状态标志或者 retire状态标志。
现有技术通过软件实现对计算机指令执行次数进行统计。 在计算机程序 中增加用于对计算机指令执行次数进行统计的代码, 例如计数函数, 降低了 计算机程序性能。 其一、 计数函数需要占用一定的存储空间, 导致计算机程 序占用更多的存储空间。 其二、 反复调用计数函数, 将延长计算机程序执行 的时间。 通过本发明实施例提出的统计装置, 对计算机指令的执行次数进行统计 时, 不需要运行计算机程序, 提高了计数的效率, 降低了处理器的负担。
可选的,
该累加单元具体包括比较单元和计数单元, 该比较单元用于当该第一计 算机指令存储在该 cache的偏移地址的后 X比特等于第一关联信息时, 发送 触发信号给计数单元;
该计数单元用于当接收到该触发信号时, 该第一计数器的值加 1 ;
其中该第一计算机指令存储在该 cache的偏移地址为 Y比特, Y大于等 于 X。
可以通过 cache 中存储的第一关联信息确定第一计算机指令以及用于统 计第一计算机指令执行次数的第一计数器。 由于 cache 中存储的信息可以被 更新, 因此可以通过更新 cache 中存储的第一关联信息为第一计数器地址确 定不同的第一计算机指令。
具体实现时, 计算机指令存储在 cache 的地址可以用基地址加偏移地址 表示。 偏移地址占用的存储空间相对较少, 第一关联信息等于第一计算机指 令存储在 cache的偏移地址的后 X比特, 因此第一关联信息占用的存储空间 相对较少。
参见图 2, 图 2为计算机指令、 计算机指令存储在 cache的偏移地址、 计 数器地址以及关联信息存储在 cache的示意图。 偏移地址的比特数为 2。 指令 一、 指令二、 指令三以及指令四的偏移地址分别是二进制数 00、 01、 10以及 11。 关联信息为 2比特。 关联信息可以是二进制数 00、 01、 10以及 11中的 任意一个。 第一计算机指令存储在 cache 的偏移地址等于第一关联信息。 指 令一、 指令二、 指令三以及指令四共有一个计数器地址, 即计数器地址一。 指令一、 指令二、 指令三以及指令四共有一个关联信息, 即关联信息一。 关 联信息一确定四条指令中哪条指令是第一计算机指令。 例如, 当关联信息是 二进制 01时, 指令二是第一计算机指令。 当关联信息为 10时, 指令三是第 一计算机指令。
本领域普通技术人员可以理解: 实现上述方法实施例的全部或部分步骤 可以通过程序指令相关的硬件来完成, 前述程序可以存储于一计算机可读取 存储介质中, 该程序在执行时, 执行包括上述方法实施例的步骤; 而前述的 存储介质包括: ROM, RAM,磁碟或者光盘等各种可以存储程序代码的介质。
最后应说明的是: 以上实施例仅用以说明本发明的技术方案, 而非对其 限制; 尽管参照前述实施例对本发明进行了详细的说明, 本领域的普通技术 人员应当理解: 其依然可以对前述各实施例所记载的技术方案进行修改, 或 者对其中部分技术特征进行等同替换; 而这些修改或者替换, 并不使相应技 术方案的本质脱离本发明各实施例技术方案的精神和范围。

Claims

权利要求
1.一种统计方法, 其特征在于:
执行第一计算机指令;
当所述第一计算机指令有对应的第一计数器地址, 则所述第一计数器 的值加 1 ;其中所述第一计算机指令和所述第一计数器地址存储在处理器的 高速緩存 cache中。
2.根据权利要求 1所述方法, 其特征在于:
所述第一计数器地址存储在处理器的高速緩存 cache中具体为:所述第 一计数器地址存储在 cache 中所述第一计算机指令对应的计数器地址空间 中, 其中所述 cache为每个计算机指令预留对应的计数器地址空间。
3.根据权利要求 1所述的方法, 其特征在于:
当所述第一计算机指令有对应的第一计数器地址, 则所述第一计数器 的值加 1具体包括:当所述第一计算机指令存储在所述 cache的偏移地址的 后 X比特等于第一关联信息时, 则所述第一计数器的值加 1, 其中所述第 一计算机指令存储在所述 cache的偏移地址为 Y比特, Y大于等于 X。
4.根据权利要求 3所述方法, 其特征在于:
所述 cache中存储的计算机指令的个数为 M, M为自然数, M与 2X的 商数为 P, 余数为 Q;
当 Q为 0时,所述 cache中存储的计数器地址的个数为 P,有 P个关联 信息, 每个关联信息的长度为 X比特, 每个关联信息等于对应的计算机指 令存储在所述 cache的偏移地址的后 X比特。
5.根据权利要求 4所述方法, 其特征在于:
当 Q不为 0时, 所述 cache中存储的计数器地址的个数为 P+l。
6.根据权利要求 1或 2所述方法, 其特征在于:
所述第一计数器的值加 1具体包括:
接收触发信号, 所述第一计数器的值加 1, 所述触发信号为执行所述第 一计算机指令过程中产生的状态标志。
7.根据权利要求 6所述方法, 其特征在于:
所述触发信号为所述第一计算机指令的写回状态标志或者生效状态标 志
8.—种统计装置, 其特征在于, 包括:
执行单元, 用于执行第一计算机指令;
累加单元, 用于当所述第一计算机指令有对应的第一计数器地址, 则 所述第一计数器的值加 1 ;其中所述第一计算机指令和所述第一计数器地址 存储在处理器的 cache中。
9.根据权利要求 8所述的装置, 其特征在于:
所述累加单元具体包括比较单元和计数单元, 所述比较单元用于当所 述第一计算机指令存储在所述 cache的偏移地址的后 X比特等于第一关联 信息时, 发送触发信号给计数单元;
所述计数单元用于当接收到所述触发信号时, 所述第一计数器的值加
1 ;
其中所述第一计算机指令存储在所述 cache的偏移地址为 Y比特, Y 大于等于 X。
PCT/CN2011/078544 2011-08-17 2011-08-17 一种统计方法及装置 WO2012083708A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2011/078544 WO2012083708A1 (zh) 2011-08-17 2011-08-17 一种统计方法及装置
CN201180001433.3A CN102388360B (zh) 2011-08-17 2011-08-17 一种统计方法及装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2011/078544 WO2012083708A1 (zh) 2011-08-17 2011-08-17 一种统计方法及装置

Publications (1)

Publication Number Publication Date
WO2012083708A1 true WO2012083708A1 (zh) 2012-06-28

Family

ID=45826488

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/078544 WO2012083708A1 (zh) 2011-08-17 2011-08-17 一种统计方法及装置

Country Status (2)

Country Link
CN (1) CN102388360B (zh)
WO (1) WO2012083708A1 (zh)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1177139A (zh) * 1996-06-24 1998-03-25 合泰半导体股份有限公司 程序计数器的地址计算方法及装置
CN1466282A (zh) * 2002-06-13 2004-01-07 华为技术有限公司 高速码流多类型数据统计总线的实现方法
US20050281202A1 (en) * 2004-06-22 2005-12-22 Intel Corporation Monitoring instructions queueing messages
CN101819553A (zh) * 2009-02-12 2010-09-01 威盛电子股份有限公司 微码指令执行次数的计数装置以及计数方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1177139A (zh) * 1996-06-24 1998-03-25 合泰半导体股份有限公司 程序计数器的地址计算方法及装置
CN1466282A (zh) * 2002-06-13 2004-01-07 华为技术有限公司 高速码流多类型数据统计总线的实现方法
US20050281202A1 (en) * 2004-06-22 2005-12-22 Intel Corporation Monitoring instructions queueing messages
CN101819553A (zh) * 2009-02-12 2010-09-01 威盛电子股份有限公司 微码指令执行次数的计数装置以及计数方法

Also Published As

Publication number Publication date
CN102388360B (zh) 2014-04-30
CN102388360A (zh) 2012-03-21

Similar Documents

Publication Publication Date Title
WO2018076793A1 (zh) 一种NVMe数据读写方法及NVMe设备
JP6316974B2 (ja) フラッシュメモリ圧縮
JP5568048B2 (ja) 並列計算機システム、およびプログラム
US10331499B2 (en) Method, apparatus, and chip for implementing mutually-exclusive operation of multiple threads
WO2022057391A1 (zh) 缓存内存调整方法、装置及计算机设备
US20200327061A1 (en) Data prefetching method and apparatus, and storage device
US9304939B2 (en) Method and multi-core communication processor for replacing data in system cache
WO2015010646A1 (zh) 混合内存的数据访问方法、模块、处理器及终端设备
WO2017054540A1 (zh) 一种数据处理方法、装置、服务器及控制器
US8302109B2 (en) Synchronization optimized queuing system
WO2020000485A1 (zh) 一种基于NVMe的数据写入方法、装置及系统
US9117032B2 (en) Facilitating routing by selectively aggregating contiguous data units
WO2021120713A1 (zh) 一种数据处理方法、解码电路及处理器
US9239804B2 (en) Back-off mechanism for a peripheral page request log
CN107273092B (zh) 一种优化数据流架构访存延迟的方法及其系统
US20160294926A1 (en) Using a single work item to send multiple messages
CN107436752B (zh) 异常现场恢复方法、装置及计算机可读存储介质
US9118597B2 (en) Method and system for requester virtual cut through
WO2018023966A1 (zh) 一种缓存策略的确定方法及装置
WO2012083708A1 (zh) 一种统计方法及装置
US20130145122A1 (en) Instruction processing method of network processor and network processor
JP2019021185A (ja) 情報処理装置、情報処理システム、情報処理装置制御方法及び情報処理装置制御プログラム
JP2018536230A (ja) キャッシュへのアクセス
WO2023082921A1 (zh) 一种网卡收包处理方法及装置
US20170085442A1 (en) Technologies for aggregation-based message synchronization

Legal Events

Date Code Title Description
WWE Wipo information: entry into national phase

Ref document number: 201180001433.3

Country of ref document: CN

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11851670

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 11851670

Country of ref document: EP

Kind code of ref document: A1