mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	No rusage on win32
This commit is contained in:
		
							parent
							
								
									ccf7b2e342
								
							
						
					
					
						commit
						d3405c15bf
					
				
					 2 changed files with 13 additions and 2 deletions
				
			
		|  | @ -268,12 +268,16 @@ int main(int argc, char **argv) | ||||||
| 		delete log_hasher; | 		delete log_hasher; | ||||||
| 		log_hasher = nullptr; | 		log_hasher = nullptr; | ||||||
| 
 | 
 | ||||||
|  | 		log_spacer(); | ||||||
|  | #ifdef WIN32 | ||||||
|  | 		log("End of script. Logfile hash: %s\n", hash.c_str()); | ||||||
|  | #else | ||||||
| 		struct rusage ru_buffer; | 		struct rusage ru_buffer; | ||||||
| 		getrusage(RUSAGE_SELF, &ru_buffer); | 		getrusage(RUSAGE_SELF, &ru_buffer); | ||||||
| 		log_spacer(); |  | ||||||
| 		log("End of script. Logfile hash: %s, CPU: user %.2fs system %.2fs\n", hash.c_str(), | 		log("End of script. Logfile hash: %s, CPU: user %.2fs system %.2fs\n", hash.c_str(), | ||||||
| 				ru_buffer.ru_utime.tv_sec + 1e-6 * ru_buffer.ru_utime.tv_usec, | 				ru_buffer.ru_utime.tv_sec + 1e-6 * ru_buffer.ru_utime.tv_usec, | ||||||
| 				ru_buffer.ru_stime.tv_sec + 1e-6 * ru_buffer.ru_stime.tv_usec); | 				ru_buffer.ru_stime.tv_sec + 1e-6 * ru_buffer.ru_stime.tv_usec); | ||||||
|  | #endif | ||||||
| 		log("%s\n", yosys_version_str); | 		log("%s\n", yosys_version_str); | ||||||
| 
 | 
 | ||||||
| 		int64_t total_ns = 0; | 		int64_t total_ns = 0; | ||||||
|  |  | ||||||
|  | @ -24,7 +24,10 @@ | ||||||
| 
 | 
 | ||||||
| #include <time.h> | #include <time.h> | ||||||
| #include <sys/time.h> | #include <sys/time.h> | ||||||
| #include <sys/resource.h> | 
 | ||||||
|  | #ifndef WIN32 | ||||||
|  | #  include <sys/resource.h> | ||||||
|  | #endif | ||||||
| 
 | 
 | ||||||
| // from libs/sha1/sha1.h
 | // from libs/sha1/sha1.h
 | ||||||
| class SHA1; | class SHA1; | ||||||
|  | @ -154,6 +157,8 @@ struct PerformanceTimer | ||||||
| 		t = 1000000000ULL * (int64_t) rusage.ru_utime.tv_sec + (int64_t) rusage.ru_utime.tv_usec * 1000ULL; | 		t = 1000000000ULL * (int64_t) rusage.ru_utime.tv_sec + (int64_t) rusage.ru_utime.tv_usec * 1000ULL; | ||||||
| 		t += 1000000000ULL * (int64_t) rusage.ru_stime.tv_sec + (int64_t) rusage.ru_stime.tv_usec * 1000ULL; | 		t += 1000000000ULL * (int64_t) rusage.ru_stime.tv_sec + (int64_t) rusage.ru_stime.tv_usec * 1000ULL; | ||||||
| 		return t; | 		return t; | ||||||
|  | #elif WIN32 | ||||||
|  | 		return 0; | ||||||
| #else | #else | ||||||
| 	#error Dont know how to measure per-process CPU time. Need alternative method (times()/clocks()/gettimeofday()?). | 	#error Dont know how to measure per-process CPU time. Need alternative method (times()/clocks()/gettimeofday()?). | ||||||
| #endif | #endif | ||||||
|  | @ -191,8 +196,10 @@ static inline void log_dump_val_worker(int v) { log("%d", v); } | ||||||
| static inline void log_dump_val_worker(unsigned int v) { log("%u", v); } | static inline void log_dump_val_worker(unsigned int v) { log("%u", v); } | ||||||
| static inline void log_dump_val_worker(long int v) { log("%ld", v); } | static inline void log_dump_val_worker(long int v) { log("%ld", v); } | ||||||
| static inline void log_dump_val_worker(unsigned long int v) { log("%lu", v); } | static inline void log_dump_val_worker(unsigned long int v) { log("%lu", v); } | ||||||
|  | #ifndef WIN32 | ||||||
| static inline void log_dump_val_worker(long long int v) { log("%lld", v); } | static inline void log_dump_val_worker(long long int v) { log("%lld", v); } | ||||||
| static inline void log_dump_val_worker(unsigned long long int v) { log("%lld", v); } | static inline void log_dump_val_worker(unsigned long long int v) { log("%lld", v); } | ||||||
|  | #endif | ||||||
| static inline void log_dump_val_worker(char c) { log(c >= 32 && c < 127 ? "'%c'" : "'\\x%02x'", c); } | static inline void log_dump_val_worker(char c) { log(c >= 32 && c < 127 ? "'%c'" : "'\\x%02x'", c); } | ||||||
| static inline void log_dump_val_worker(unsigned char c) { log(c >= 32 && c < 127 ? "'%c'" : "'\\x%02x'", c); } | static inline void log_dump_val_worker(unsigned char c) { log(c >= 32 && c < 127 ? "'%c'" : "'\\x%02x'", c); } | ||||||
| static inline void log_dump_val_worker(bool v) { log("%s", v ? "true" : "false"); } | static inline void log_dump_val_worker(bool v) { log("%s", v ? "true" : "false"); } | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue