CN107045425B - Implementation method of high-precision time-measuring subsystem - Google Patents
Implementation method of high-precision time-measuring subsystem Download PDFInfo
- Publication number
- CN107045425B CN107045425B CN201710131915.XA CN201710131915A CN107045425B CN 107045425 B CN107045425 B CN 107045425B CN 201710131915 A CN201710131915 A CN 201710131915A CN 107045425 B CN107045425 B CN 107045425B
- Authority
- CN
- China
- Prior art keywords
- current
- real
- reload
- timing
- hardware
- 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.)
- Expired - Fee Related
Links
- 238000000034 method Methods 0.000 title claims abstract description 8
- 230000002159 abnormal effect Effects 0.000 claims description 2
- 239000007787 solid Substances 0.000 abstract description 6
- 238000010586 diagram Methods 0.000 description 4
- 230000003247 decreasing effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/0604—Improving or facilitating administration, e.g. storage management
- G06F3/0607—Improving or facilitating administration, e.g. storage management by facilitating the process of upgrading existing storage systems, e.g. for improving compatibility between host and storage device
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0602—Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
- G06F3/061—Improving I/O performance
- G06F3/0611—Improving I/O performance in relation to response time
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0628—Interfaces specially adapted for storage systems making use of a particular technique
- G06F3/0655—Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
- G06F3/0658—Controller construction arrangements
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F3/00—Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
- G06F3/06—Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
- G06F3/0601—Interfaces specially adapted for storage systems
- G06F3/0668—Interfaces specially adapted for storage systems adopting a particular infrastructure
- G06F3/0671—In-line storage system
- G06F3/0673—Single storage device
- G06F3/0679—Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]
Abstract
The invention discloses a method for realizing a time subsystem of a high-precision meter, which comprises the following stepsIs characterized in that two hardware timers, namely a hardware timer T0 and a hardware timer T1 are arranged, the two hardware timers respectively and independently work, and T0realAnd T1realAnd C0reloadAnd C1reloadForming a differential relationship; when the microprocessor core needs to read the timing output T of the current subsystemcurrentAt this time, the timing output value T0 of the hardware timer 0 is readcurrentAnd the current timing output value T1 of the hardware timer 1currentWhen T0current=T1currentWhen, TcurrentIs T0currentOr T1current(ii) a When T0current!=T1currentAccording to T0realAnd T1realAnd C0reloadAnd C1reloadThe difference relation of the sub-system is judged and obtainedcurrent. By adopting the differential timing of the two hardware timers in the solid state disk main controller, the timing data can be accurately acquired when the multi-core asynchronous access timing subsystem is ensured, and the precision of the timing subsystem is improved to the pure hardware precision of the timers.
Description
Technical Field
The invention relates to the field of chip design, in particular to a method for realizing a high-precision time-measuring subsystem of various main control chips with high requirements on a timing system.
Background
Based on performance considerations, a main control chip in a solid state disk usually adopts a plurality of processor cores, and a plurality of hardware timer resources are shared among multiple cores; the hardware timer works as follows: automatic loading of preset time length value T after initialization of hardware timerinitcountAfter the value is gradually decreased to 0, the timer hardware is automatically loaded with T againinitcountAnd triggering the interrupt, and working in a circulating way to trigger the interrupt at regular time. A solid state disk timing subsystem is generally realized by combining software and hardware, and FIG. 1 is a timing work schematic diagram of a conventional timing subsystem, wherein after a hardware Timer HW Timer 0 is triggered and interrupted, a processor core enters an interrupt service program to increment the number of times of Timer reloading Creload(ii) a Timer real-time value T read back by processor corerealThe current time value is Tcurrent=T0+Treal,T0=TinitcountX Creload. Under normal conditions, the precision of the timing subsystem is required to be the pure hardness of a timerPiece precision; but when the timing subsystem is in the metering blind zone (the metering blind zone is: heavy load T of hardware timer)initcountAnd triggering the interrupt until the interrupt service routine is completed CreloadBefore the value is incremented), C read by another processor corereloadThe value will be 1 less than the actual value, i.e. T calculated by the timing subsystemcurrentThe value is smaller than the actual value by Tinitcount,Causing the accuracy of the timing subsystem to be reduced to Tinitcount,Compared with a timer, the precision of pure hardware is different by thousands of times.
Disclosure of Invention
Aiming at the defects, the invention aims to solve the problem that the timing precision of the timing subsystem is reduced when a metering blind area occurs.
In order to achieve the above object, the present invention provides a method for implementing a high-precision time counting subsystem, which is characterized in that two hardware timers, namely a hardware timer T0 and a hardware timer T1, are provided, the two hardware timers respectively and independently operate, and T0realAnd T1realAnd C0reloadAnd C1reloadForming a differential relationship; t0realReal-time value of hardware timer T0, T1realReal-time value of hardware timer T1, C0reloadThe number of times of reloading of the hardware timer T0, C1reloadThe number of times of reloading of the hardware timer T1; when the microprocessor core needs to read the timing output T of the current subsystemcurrentAt this time, the timing output value T0 of the hardware timer 0 is readcurrentAnd the current timing output value T1 of the hardware timer 1currentWhen T0current=T1currentWhen, TcurrentIs T0currentOr T1current(ii) a When T0current!=T1currentAccording to T0realAnd T1realAnd C0reloadAnd C1reloadThe difference relation of the sub-system is judged and obtainedcurrent。
The high-precision timing subsystem is realized according to T0realAnd T1realAnd C0reloadAnd C1reloadThe difference relation of the sub-system is judged and obtainedcurrentThe judgment is carried out according to the following method:
(1))T1real=T0real+Tinitcountand C0reload=2C1reloadThen Tcurrent=2TinitcountX C1reload+T1real;
(2)T1real=T0realAnd C0reload=2C1reload1 is then Tcurrent=2TinitcountX C1reload+T1real;
(3)T1real=T0realAnd C0reload=2C1reloadThen Tcurrent=2TinitcountX C1reload+T1real;
(4)T1real=T0realAnd C0reload=2C1reload+1 is Tcurrent=2TinitcountX(C1reload+1)+T1real;
(5)T1real=T0realAnd C0reload=2C1reload+2 is Tcurrent=2TinitcountX(C1reload+1)+T1real;
(6) If T1 fails to satisfy the above condition, it is determined that the timing subsystem is abnormal in timing, and the timing subsystem is required to be reset.
According to the method, two hardware timers in the solid state disk main controller are used for differential timing, so that the timing data can be accurately acquired when the multi-core asynchronous access timing subsystem is ensured, and the precision of the timing subsystem is improved to the pure hardware precision of the timers.
Drawings
FIG. 1 is a schematic diagram of a conventional timing subsystem timing operation;
FIG. 2 is a schematic diagram of the timing operation of the high accuracy timing subsystem.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Fig. 2 is a schematic diagram of the timing operation of the high-precision timing subsystem, which is described by taking a solid state disk as an example, and two hardware timers and an interrupt service routine thereof in the solid state disk host controller are respectively a hardware Timer 0HW Timer 0 and a hardware Timer 1HW Timer 1 for completing the timing operation. Hardware timer 0 automatic reload period is Tinitcount,The current time value calculated by the microprocessor core is T0current=TinitcountX C0reload+T0real(ii) a The automatic overload period of the hardware timer 1 is 2Tinitcount,The current time value calculated by the microprocessor core is T1current=2TinitcountX C1reload+T1real。
When T0currentAnd T1currentThe numerical values are consistent, and the value T is output in timingcurrent=2TinitcountX C1reload+T1real;
When T0currentAnd T1currentIf the values are not consistent, the timing subsystem may be in a metering pseudo-blind zone, which may be determined according to T0realAnd T1realAnd C0reloadAnd C1reloadThe formed difference relationship identifies the metering pseudo-blind area and deduces the real timing output value Tcurrent:
(1) If the timing subsystem is in the metering pseudo-blind area 1, T0 is detected because the hardware timer 1 is not overloadedreal、T1realAnd C1reloadThe values are all true values, C0reloadLess than 1 than the true value.
When T1realEqual to T0real+TinitcountAnd C0reloadEqual to 2C1reloadThe timing subsystem can be identified to be in a metering pseudo-blind area 1; output value T of timing subsystemcurrent=2TinitcountX C1reload+T1real;
(2) If the timing subsystem is in the metering pseudo-blind area 0, at the moment, the hardware timer 0 and the hardware timer 1 are overloaded, T0real、T1realThe values being true values, C0reload、C1reloadMay be less than 1 than the true value.
When T1realEqual to T0realAnd C0reloadEqual to 2C1reload-1 can identify that the timing subsystem is in metering pseudo-blind zone 0, and C0reloadIncomplete increment, 1 less than true value, C1reloadCompleting increment and obtaining a true value; output value T of timing subsystemcurrent=2TinitcountX C1reload+T1real;
When T1realEqual to T0realAnd C0reloadEqual to 2C1reloadIt can be identified that the timing subsystem is in non-metering pseudo-blind zone 0, and C0reloadComplete increment, true value, C1reloadCompleting increment and obtaining a true value; output value T of timing subsystemcurrent=2TinitcountX C1reload+T1real;
When T1realEqual to T0realAnd C0reloadEqual to 2C1reload+1 may identify that the timing subsystem is in metering pseudo-blind zone 0, and C0reloadIncomplete increment, 1 less than true value, C1reloadIncomplete increment is 1 less than the true value; output value T of timing subsystemcurrent=2TinitcountX(C1reload+1)+T1real;
When T1realEqual to T0realAnd C0reloadEqual to 2C1reload+2 may identify that the timing subsystem is in metering pseudo-blind zone 0, and C0reloadComplete increment, true value, C1read noneFinishing increasing and reducing the value by 1 compared with the true value; output value T of timing subsystemcurrent=2TinitcountX(C1reload+1)+T1real;
(3) Situations other than those described above may be considered as a timing subsystem exception, requiring the timing subsystem to be reset.
In summary, the timing subsystem can be based on T0real、T1real、C0reload、C1reloadUsing T0realAnd T1realAnd C0reloadAnd C1reloadThe formed differential relation effectively identifies the metering pseudo-blind area, accurately judges the working state of the hardware timer and deduces a real timing output value Tcurrent。
While the invention has been described with reference to a particular embodiment, it will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.
Claims (1)
1. A method for realizing a high-precision time counting subsystem is characterized in that two hardware timers, namely a hardware timer T0 and a hardware timer T1 are arranged, the two hardware timers respectively and independently work, and T0realAnd T1realAnd C0reloadAnd C1reloadForming a differential relationship; t0realReal-time value of hardware timer T0, T1realReal-time value of hardware timer T1, C0reloadThe number of times of reloading of the hardware timer T0, C1reloadThe number of times of reloading of the hardware timer T1; when the microprocessor core needs to read the timing output T of the current subsystemcurrentAt this time, the timing output value T0 of the hardware timer 0 is readcurrentAnd the current timing output value T1 of the hardware timer 1currentWhen T0current=T1currentWhen, TcurrentIs T0currentOr T1current(ii) a When T0current!=T1currentAccording to T0realAnd T1realAnd C0reloadAnd C1reloadThe difference relation of the sub-system is judged and obtainedcurrent(ii) a Said is according to T0realAnd T1realAnd C0reloadAnd C1reloadThe difference relation of the sub-system is judged and obtainedcurrentAccording to the following methodAnd (4) line judgment:
(1)T1real=T0real+Tinitcountand C0reload=2C1reloadThen Tcurrent=2TinitcountX C1reload+T1real;
(2)T1real=T0realAnd C0reload=2C1reload1 is then Tcurrent=2TinitcountX C1reload+T1real;
(3)T1real=T0realAnd C0reload=2C1reloadThen Tcurrent=2TinitcountX C1reload+T1real;
(4)T1real=T0realAnd C0reload=2C1reload+1 is Tcurrent=2TinitcountX(C1reload+1)+T1real;
(5)T1real=T0realAnd C0reload=2C1reload+2 is Tcurrent=2TinitcountX(C1reload+1)+T1real;
(6) If T1 fails to satisfy the above condition, it is determined that the timing subsystem is abnormal in timing, and the timing subsystem is required to be reset.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710131915.XA CN107045425B (en) | 2017-03-07 | 2017-03-07 | Implementation method of high-precision time-measuring subsystem |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710131915.XA CN107045425B (en) | 2017-03-07 | 2017-03-07 | Implementation method of high-precision time-measuring subsystem |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107045425A CN107045425A (en) | 2017-08-15 |
CN107045425B true CN107045425B (en) | 2020-01-10 |
Family
ID=59544156
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710131915.XA Expired - Fee Related CN107045425B (en) | 2017-03-07 | 2017-03-07 | Implementation method of high-precision time-measuring subsystem |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107045425B (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2009026035A (en) * | 2007-07-19 | 2009-02-05 | Nec Corp | Interrupt processing synchronizing device, interrupt processing synchronizing method, and program |
CN103257670A (en) * | 2012-02-21 | 2013-08-21 | 北京国微集成技术有限公司 | Embedded system and timing method thereof |
CN104133520A (en) * | 2014-07-29 | 2014-11-05 | 江苏宏云技术有限公司 | High-precision calibration method of oscillators in embedded processor chip |
CN105183930A (en) * | 2015-06-16 | 2015-12-23 | 北京天诚盛业科技有限公司 | Methods and devices for setting and using hardware timer |
CN105550156A (en) * | 2015-12-02 | 2016-05-04 | 浙江大华技术股份有限公司 | Time synchronization method and device |
-
2017
- 2017-03-07 CN CN201710131915.XA patent/CN107045425B/en not_active Expired - Fee Related
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2009026035A (en) * | 2007-07-19 | 2009-02-05 | Nec Corp | Interrupt processing synchronizing device, interrupt processing synchronizing method, and program |
CN103257670A (en) * | 2012-02-21 | 2013-08-21 | 北京国微集成技术有限公司 | Embedded system and timing method thereof |
CN104133520A (en) * | 2014-07-29 | 2014-11-05 | 江苏宏云技术有限公司 | High-precision calibration method of oscillators in embedded processor chip |
CN105183930A (en) * | 2015-06-16 | 2015-12-23 | 北京天诚盛业科技有限公司 | Methods and devices for setting and using hardware timer |
CN105550156A (en) * | 2015-12-02 | 2016-05-04 | 浙江大华技术股份有限公司 | Time synchronization method and device |
Also Published As
Publication number | Publication date |
---|---|
CN107045425A (en) | 2017-08-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20230305880A1 (en) | Cluster distributed resource scheduling method, apparatus and device, and storage medium | |
WO2013126066A1 (en) | Wear-leveling cores of a multi-core processor | |
EP3782032B1 (en) | Enforcing central processing unit quality of service guarantees when servicing accelerator requests | |
US20040039935A1 (en) | Method and device for measuring the execution time of a real task in a real time system | |
CN109739659B (en) | Message consumption method and system of distributed message queue | |
US10310890B2 (en) | Control method for virtual machine system, and virtual machine system | |
CN107045425B (en) | Implementation method of high-precision time-measuring subsystem | |
CN103164321A (en) | Occupancy rate measuring method and device of central processing unit | |
CN111007763A (en) | IIC bus unlocking control method | |
CN100501694C (en) | Processor availability measuring device and method | |
US20130262911A1 (en) | Method and data processing unit for providing a timestamp | |
JP5881890B2 (en) | Air conditioner management apparatus and method | |
KR102520596B1 (en) | Electronic apparatus for processing task, method thereof, and computer-readable medium | |
EP1586995B1 (en) | Digital controller controlling execution of periodic control tasks | |
JP2001318807A (en) | Method and device for controlling task switching | |
CN103823711A (en) | Method and device for providing relative timing in Java virtual machine | |
KR101635816B1 (en) | Apparatus and method for thread progress tracking using deterministic progress index | |
WO2020077495A1 (en) | Command scheduling method and device and storage medium | |
JP6236996B2 (en) | Information processing apparatus and information processing apparatus control method | |
WO2022257389A1 (en) | Task delay risk detection method, electronic device and storage medium | |
CN110633169B (en) | Backup computer storage system | |
JP2010009258A (en) | Fault detection device of software | |
CN117331421B (en) | Micro control chip, resetting method thereof and storage medium | |
US20210326232A1 (en) | Increasing cpu clock speed to improve system performance | |
CN111597016B (en) | System task time protection method, system, storage medium and terminal |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20200110 |