mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Small improvements in PerformanceTimer API
This commit is contained in:
		
							parent
							
								
									77a1462f2d
								
							
						
					
					
						commit
						ddd31a0b66
					
				
					 1 changed files with 7 additions and 6 deletions
				
			
		
							
								
								
									
										13
									
								
								kernel/log.h
									
										
									
									
									
								
							
							
						
						
									
										13
									
								
								kernel/log.h
									
										
									
									
									
								
							|  | @ -199,12 +199,12 @@ struct PerformanceTimer | ||||||
| 		total_ns = 0; | 		total_ns = 0; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void add() { | 	void begin() { | ||||||
| 		total_ns += query(); | 		total_ns -= query(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	void sub() { | 	void end() { | ||||||
| 		total_ns -= query(); | 		total_ns += query(); | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	float sec() const { | 	float sec() const { | ||||||
|  | @ -212,8 +212,8 @@ struct PerformanceTimer | ||||||
| 	} | 	} | ||||||
| #else | #else | ||||||
| 	void reset() { } | 	void reset() { } | ||||||
| 	void add() { } | 	void begin() { } | ||||||
| 	void sub() { } | 	void end() { } | ||||||
| 	float sec() const { return 0; } | 	float sec() const { return 0; } | ||||||
| #endif | #endif | ||||||
| }; | }; | ||||||
|  | @ -235,6 +235,7 @@ static inline void log_dump_val_worker(double v) { log("%f", v); } | ||||||
| static inline void log_dump_val_worker(const char *v) { log("%s", v); } | static inline void log_dump_val_worker(const char *v) { log("%s", v); } | ||||||
| static inline void log_dump_val_worker(std::string v) { log("%s", v.c_str()); } | static inline void log_dump_val_worker(std::string v) { log("%s", v.c_str()); } | ||||||
| static inline void log_dump_val_worker(RTLIL::SigSpec v) { log("%s", log_signal(v)); } | static inline void log_dump_val_worker(RTLIL::SigSpec v) { log("%s", log_signal(v)); } | ||||||
|  | static inline void log_dump_val_worker(PerformanceTimer p) { log("%f seconds", p.sec()); } | ||||||
| static inline void log_dump_args_worker(const char *p) { log_assert(*p == 0); } | static inline void log_dump_args_worker(const char *p) { log_assert(*p == 0); } | ||||||
| 
 | 
 | ||||||
| template<typename T> | template<typename T> | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue