Changeset deda7e6 for libcfa/src
- Timestamp:
- Sep 21, 2023, 10:15:58 PM (2 years ago)
- Branches:
- master
- Children:
- 62c6cfa
- Parents:
- c1e66d9 (diff), 5a1ae14 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- libcfa/src
- Files:
-
- 2 added
- 12 edited
-
Makefile.am (modified) (3 diffs)
-
clock.hfa (modified) (2 diffs)
-
collections/string.cfa (modified) (1 diff)
-
collections/string.hfa (modified) (1 diff)
-
collections/string_res.cfa (modified) (1 diff)
-
collections/string_res.hfa (modified) (1 diff)
-
common.hfa (modified) (1 diff)
-
concurrency/cofor.cfa (added)
-
concurrency/cofor.hfa (added)
-
concurrency/coroutine.cfa (modified) (2 diffs)
-
concurrency/kernel/cluster.hfa (modified) (2 diffs)
-
heap.cfa (modified) (3 diffs)
-
heap.hfa (modified) (2 diffs)
-
iostream.cfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/Makefile.am
rc1e66d9 rdeda7e6 11 11 ## Created On : Sun May 31 08:54:01 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Wed Aug 30 21:22:45202314 ## Update Count : 26 313 ## Last Modified On : Mon Sep 18 17:06:56 2023 14 ## Update Count : 264 15 15 ############################################################################### 16 16 … … 118 118 concurrency/mutex_stmt.hfa \ 119 119 concurrency/channel.hfa \ 120 concurrency/actor.hfa 120 concurrency/actor.hfa 121 121 122 122 inst_thread_headers_src = \ … … 130 130 concurrency/mutex.hfa \ 131 131 concurrency/select.hfa \ 132 concurrency/thread.hfa 132 concurrency/thread.hfa \ 133 concurrency/cofor.hfa 133 134 134 135 thread_libsrc = ${inst_thread_headers_src} ${inst_thread_headers_src:.hfa=.cfa} \ -
libcfa/src/clock.hfa
rc1e66d9 rdeda7e6 10 10 // Created On : Thu Apr 12 14:36:06 2018 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Apr 18 08:12:16 202113 // Update Count : 2812 // Last Modified On : Sat Sep 9 14:07:17 2023 13 // Update Count : 30 14 14 // 15 15 … … 91 91 // discontinuous jumps when the OS is not running the kernal thread. A duration is returned because the value is 92 92 // relative and cannot be converted to real-time (wall-clock) time. 93 Duration processor () {// non-monotonic duration of kernel thread93 Duration processor_cpu() { // non-monotonic duration of kernel thread 94 94 timespec ts; 95 95 clock_gettime( CLOCK_THREAD_CPUTIME_ID, &ts ); 96 96 return (Duration){ ts }; 97 } // processor 97 } // processor_cpu 98 98 99 99 // Program CPU-time watch measures CPU time consumed by all processors (kernel threads) in the UNIX process. This 100 100 // watch is affected by discontinuous jumps when the OS is not running the kernel threads. A duration is returned 101 101 // because the value is relative and cannot be converted to real-time (wall-clock) time. 102 Duration program () {// non-monotonic duration of program CPU102 Duration program_cpu() { // non-monotonic duration of program CPU 103 103 timespec ts; 104 104 clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &ts ); 105 105 return (Duration){ ts }; 106 } // program 106 } // program_cpu 107 107 108 108 // Monotonic duration from machine boot and including system suspension. This watch is unaffected by discontinuous -
libcfa/src/collections/string.cfa
rc1e66d9 rdeda7e6 157 157 // Comparison 158 158 159 bool ?==?(const string & s, const string & other) { 160 return *s.inner == *other.inner; 161 } 162 163 bool ?!=?(const string & s, const string & other) { 164 return *s.inner != *other.inner; 165 } 166 167 bool ?==?(const string & s, const char * other) { 168 return *s.inner == other; 169 } 170 171 bool ?!=?(const string & s, const char * other) { 172 return *s.inner != other; 173 } 159 int cmp (const string &s1, const string &s2) { return cmp(*s1.inner , *s2.inner); } 160 bool ?==?(const string &s1, const string &s2) { return *s1.inner == *s2.inner ; } 161 bool ?!=?(const string &s1, const string &s2) { return *s1.inner != *s2.inner ; } 162 bool ?>? (const string &s1, const string &s2) { return *s1.inner > *s2.inner ; } 163 bool ?>=?(const string &s1, const string &s2) { return *s1.inner >= *s2.inner ; } 164 bool ?<=?(const string &s1, const string &s2) { return *s1.inner <= *s2.inner ; } 165 bool ?<? (const string &s1, const string &s2) { return *s1.inner < *s2.inner ; } 166 167 int cmp (const string &s1, const char* s2) { return cmp(*s1.inner , s2 ); } 168 bool ?==?(const string &s1, const char* s2) { return *s1.inner == s2 ; } 169 bool ?!=?(const string &s1, const char* s2) { return *s1.inner != s2 ; } 170 bool ?>? (const string &s1, const char* s2) { return *s1.inner > s2 ; } 171 bool ?>=?(const string &s1, const char* s2) { return *s1.inner >= s2 ; } 172 bool ?<=?(const string &s1, const char* s2) { return *s1.inner <= s2 ; } 173 bool ?<? (const string &s1, const char* s2) { return *s1.inner < s2 ; } 174 175 int cmp (const char* s1, const string &s2) { return cmp( s1 , *s2.inner); } 176 bool ?==?(const char* s1, const string &s2) { return s1 == *s2.inner ; } 177 bool ?!=?(const char* s1, const string &s2) { return s1 != *s2.inner ; } 178 bool ?>? (const char* s1, const string &s2) { return s1 > *s2.inner ; } 179 bool ?>=?(const char* s1, const string &s2) { return s1 >= *s2.inner ; } 180 bool ?<=?(const char* s1, const string &s2) { return s1 <= *s2.inner ; } 181 bool ?<? (const char* s1, const string &s2) { return s1 < *s2.inner ; } 182 174 183 175 184 //////////////////////////////////////////////////////// -
libcfa/src/collections/string.hfa
rc1e66d9 rdeda7e6 116 116 117 117 // Comparisons 118 bool ?==?(const string & s, const string & other); 119 bool ?!=?(const string & s, const string & other); 120 bool ?==?(const string & s, const char * other); 121 bool ?!=?(const string & s, const char * other); 118 int cmp (const string &, const string &); 119 bool ?==?(const string &, const string &); 120 bool ?!=?(const string &, const string &); 121 bool ?>? (const string &, const string &); 122 bool ?>=?(const string &, const string &); 123 bool ?<=?(const string &, const string &); 124 bool ?<? (const string &, const string &); 125 126 int cmp (const string &, const char*); 127 bool ?==?(const string &, const char*); 128 bool ?!=?(const string &, const char*); 129 bool ?>? (const string &, const char*); 130 bool ?>=?(const string &, const char*); 131 bool ?<=?(const string &, const char*); 132 bool ?<? (const string &, const char*); 133 134 int cmp (const char*, const string &); 135 bool ?==?(const char*, const string &); 136 bool ?!=?(const char*, const string &); 137 bool ?>? (const char*, const string &); 138 bool ?>=?(const char*, const string &); 139 bool ?<=?(const char*, const string &); 140 bool ?<? (const char*, const string &); 141 122 142 123 143 // Slicing -
libcfa/src/collections/string_res.cfa
rc1e66d9 rdeda7e6 637 637 // Comparisons 638 638 639 640 bool ?==?(const string_res &s1, const string_res &s2) { 641 return ByteCmp( s1.Handle.s, 0, s1.Handle.lnth, s2.Handle.s, 0, s2.Handle.lnth) == 0; 642 } 643 644 bool ?!=?(const string_res &s1, const string_res &s2) { 645 return !(s1 == s2); 646 } 647 bool ?==?(const string_res &s, const char* other) { 648 string_res sother = other; 649 return s == sother; 650 } 651 bool ?!=?(const string_res &s, const char* other) { 652 return !(s == other); 653 } 639 int cmp(const string_res &s1, const string_res &s2) { 640 // return 0; 641 int ans1 = memcmp(s1.Handle.s, s2.Handle.s, min(s1.Handle.lnth, s2.Handle.lnth)); 642 if (ans1 != 0) return ans1; 643 return s1.Handle.lnth - s2.Handle.lnth; 644 } 645 646 bool ?==?(const string_res &s1, const string_res &s2) { return cmp(s1, s2) == 0; } 647 bool ?!=?(const string_res &s1, const string_res &s2) { return cmp(s1, s2) != 0; } 648 bool ?>? (const string_res &s1, const string_res &s2) { return cmp(s1, s2) > 0; } 649 bool ?>=?(const string_res &s1, const string_res &s2) { return cmp(s1, s2) >= 0; } 650 bool ?<=?(const string_res &s1, const string_res &s2) { return cmp(s1, s2) <= 0; } 651 bool ?<? (const string_res &s1, const string_res &s2) { return cmp(s1, s2) < 0; } 652 653 int cmp (const string_res &s1, const char* s2) { 654 string_res s2x = s2; 655 return cmp(s1, s2x); 656 } 657 658 bool ?==?(const string_res &s1, const char* s2) { return cmp(s1, s2) == 0; } 659 bool ?!=?(const string_res &s1, const char* s2) { return cmp(s1, s2) != 0; } 660 bool ?>? (const string_res &s1, const char* s2) { return cmp(s1, s2) > 0; } 661 bool ?>=?(const string_res &s1, const char* s2) { return cmp(s1, s2) >= 0; } 662 bool ?<=?(const string_res &s1, const char* s2) { return cmp(s1, s2) <= 0; } 663 bool ?<? (const string_res &s1, const char* s2) { return cmp(s1, s2) < 0; } 664 665 int cmp (const char* s1, const string_res & s2) { 666 string_res s1x = s1; 667 return cmp(s1x, s2); 668 } 669 670 bool ?==?(const char* s1, const string_res &s2) { return cmp(s1, s2) == 0; } 671 bool ?!=?(const char* s1, const string_res &s2) { return cmp(s1, s2) != 0; } 672 bool ?>? (const char* s1, const string_res &s2) { return cmp(s1, s2) > 0; } 673 bool ?>=?(const char* s1, const string_res &s2) { return cmp(s1, s2) >= 0; } 674 bool ?<=?(const char* s1, const string_res &s2) { return cmp(s1, s2) <= 0; } 675 bool ?<? (const char* s1, const string_res &s2) { return cmp(s1, s2) < 0; } 676 654 677 655 678 -
libcfa/src/collections/string_res.hfa
rc1e66d9 rdeda7e6 142 142 143 143 // Comparisons 144 bool ?==?(const string_res &s, const string_res &other); 145 bool ?!=?(const string_res &s, const string_res &other); 146 bool ?==?(const string_res &s, const char* other); 147 bool ?!=?(const string_res &s, const char* other); 144 int cmp (const string_res &, const string_res &); 145 bool ?==?(const string_res &, const string_res &); 146 bool ?!=?(const string_res &, const string_res &); 147 bool ?>? (const string_res &, const string_res &); 148 bool ?>=?(const string_res &, const string_res &); 149 bool ?<=?(const string_res &, const string_res &); 150 bool ?<? (const string_res &, const string_res &); 151 152 int cmp (const string_res &, const char*); 153 bool ?==?(const string_res &, const char*); 154 bool ?!=?(const string_res &, const char*); 155 bool ?>? (const string_res &, const char*); 156 bool ?>=?(const string_res &, const char*); 157 bool ?<=?(const string_res &, const char*); 158 bool ?<? (const string_res &, const char*); 159 160 int cmp (const char*, const string_res &); 161 bool ?==?(const char*, const string_res &); 162 bool ?!=?(const char*, const string_res &); 163 bool ?>? (const char*, const string_res &); 164 bool ?>=?(const char*, const string_res &); 165 bool ?<=?(const char*, const string_res &); 166 bool ?<? (const char*, const string_res &); 148 167 149 168 // String search -
libcfa/src/common.hfa
rc1e66d9 rdeda7e6 69 69 T min( T v1, T v2 ) { return v1 < v2 ? v1 : v2; } 70 70 71 forall( T, Ts... | { T min( T, T ); T min( T, T s ); } )72 T min( T v1, T v2, T s vs ) { return min( min( v1, v2 ), vs ); }71 forall( T, Ts... | { T min( T, T ); T min( T, T, Ts ); } ) 72 T min( T v1, T v2, T v3, Ts vs ) { return min( min( v1, v2 ), v3, vs ); } 73 73 74 74 forall( T | { int ?>?( T, T ); } ) 75 75 T max( T v1, T v2 ) { return v1 > v2 ? v1 : v2; } 76 76 77 forall( T, Ts... | { T max( T, T ); T max( T, T s ); } )78 T max( T v1, T v2, T s vs ) { return max( max( v1, v2 ), vs ); }77 forall( T, Ts... | { T max( T, T ); T max( T, T, Ts ); } ) 78 T max( T v1, T v2, T v3, Ts vs ) { return max( max( v1, v2 ), v3, vs ); } 79 79 80 80 forall( T | { T min( T, T ); T max( T, T ); } ) -
libcfa/src/concurrency/coroutine.cfa
rc1e66d9 rdeda7e6 10 10 // Created On : Mon Nov 28 12:27:26 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 16 15:34:46202313 // Update Count : 2 412 // Last Modified On : Mon Sep 18 21:47:12 2023 13 // Update Count : 25 14 14 // 15 15 … … 364 364 // resume non local exception at receiver (i.e. enqueue in ehm buffer) 365 365 forall(exceptT *, T & | ehm_resume_at( exceptT, T )) 366 void resumeAt( T & receiver, exceptT & ex ) libcfa_public {366 void resumeAt( T & receiver, exceptT & ex ) libcfa_public { 367 367 coroutine$ * cor = get_coroutine( receiver ); 368 368 nonlocal_exception * nl_ex = alloc(); -
libcfa/src/concurrency/kernel/cluster.hfa
rc1e66d9 rdeda7e6 31 31 32 32 // warn normally all ints 33 #define warn_large_before warnf( !strict || old_avg < 33_000_000_000, "Suspiciously large previous average: %'llu (%llx), %'" PRId64 "ms \n", old_avg, old_avg, program ()`ms )34 #define warn_large_after warnf( !strict || ret < 33_000_000_000, "Suspiciously large new average after %'" PRId64 "ms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program ()`ms, ret, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg )33 #define warn_large_before warnf( !strict || old_avg < 33_000_000_000, "Suspiciously large previous average: %'llu (%llx), %'" PRId64 "ms \n", old_avg, old_avg, program_cpu()`ms ) 34 #define warn_large_after warnf( !strict || ret < 33_000_000_000, "Suspiciously large new average after %'" PRId64 "ms cputime: %'llu (%llx) from %'llu-%'llu (%'llu, %'llu) and %'llu\n", program_cpu()`ms, ret, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ) 35 35 36 36 // 8X linear factor is just 8 * x … … 42 42 static inline __readyQ_avg_t __to_readyQ_avg(unsigned long long intsc) { if(unlikely(0 == intsc)) return 0.0; else return log2((__readyQ_avg_t)intsc); } 43 43 44 #define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %'" PRId64 "ms \n", old_avg, program ()`ms )45 #define warn_large_after warnf( !strict || ret < 35.3, "Suspiciously large new average after %'" PRId64 "ms cputime: %'lf from %'llu-%'llu (%'llu, %'llu) and %'lf\n", program ()`ms, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ); \44 #define warn_large_before warnf( !strict || old_avg < 35.0, "Suspiciously large previous average: %'lf, %'" PRId64 "ms \n", old_avg, program_cpu()`ms ) 45 #define warn_large_after warnf( !strict || ret < 35.3, "Suspiciously large new average after %'" PRId64 "ms cputime: %'lf from %'llu-%'llu (%'llu, %'llu) and %'lf\n", program_cpu()`ms, ret, currtsc, intsc, new_val, new_val / 1000000, old_avg ); \ 46 46 verify(ret >= 0) 47 47 -
libcfa/src/heap.cfa
rc1e66d9 rdeda7e6 10 10 // Created On : Tue Dec 19 21:58:35 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 2 18:48:30 202313 // Update Count : 161 412 // Last Modified On : Mon Sep 11 11:21:10 2023 13 // Update Count : 1615 14 14 // 15 15 … … 691 691 return stats; 692 692 } // collectStats 693 694 static inline void clearStats() { 695 lock( mgrLock ); 696 697 // Zero the heap master and all active thread heaps. 698 HeapStatisticsCtor( heapMaster.stats ); 699 for ( Heap * heap = heapMaster.heapManagersList; heap; heap = heap->nextHeapManager ) { 700 HeapStatisticsCtor( heap->stats ); 701 } // for 702 703 unlock( mgrLock ); 704 } // clearStats 693 705 #endif // __STATISTICS__ 694 706 … … 1556 1568 1557 1569 1570 // Zero the heap master and all active thread heaps. 1571 void malloc_stats_clear() { 1572 #ifdef __STATISTICS__ 1573 clearStats(); 1574 #else 1575 #define MALLOC_STATS_MSG "malloc_stats statistics disabled.\n" 1576 if ( write( STDERR_FILENO, MALLOC_STATS_MSG, sizeof( MALLOC_STATS_MSG ) - 1 /* size includes '\0' */ ) == -1 ) { 1577 abort( "**** Error **** write failed in malloc_stats" ); 1578 } // if 1579 #endif // __STATISTICS__ 1580 } // malloc_stats_clear 1581 1582 1558 1583 // Changes the file descriptor where malloc_stats() writes statistics. 1559 1584 int malloc_stats_fd( int fd __attribute__(( unused )) ) libcfa_public { -
libcfa/src/heap.hfa
rc1e66d9 rdeda7e6 10 10 // Created On : Tue May 26 11:23:55 2020 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Oct 4 19:08:55 202213 // Update Count : 2 312 // Last Modified On : Mon Sep 11 11:18:18 2023 13 // Update Count : 24 14 14 // 15 15 … … 43 43 size_t malloc_mmap_start(); // crossover allocation size from sbrk to mmap 44 44 size_t malloc_unfreed(); // heap unfreed size (bytes) 45 void malloc_stats_clear(); // clear heap statistics 45 46 } // extern "C" 46 47 -
libcfa/src/iostream.cfa
rc1e66d9 rdeda7e6 1 1 2 // 2 3 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo … … 976 977 if ( f.flags.ignore ) { fmtstr[1] = '*'; start += 1; } 977 978 // no maximum width necessary because text ignored => width is read width 978 if ( f.wd != -1 ) { start += sprintf( &fmtstr[start], "%d", f.wd ); } 979 if ( f.wd != -1 ) { 980 // wd is buffer bytes available (for input chars + null terminator) 981 // rwd is count of input chars 982 int rwd = f.flags.rwd ? f.wd : (f.wd - 1); 983 start += sprintf( &fmtstr[start], "%d", rwd ); 984 } 979 985 980 986 if ( ! scanset ) { … … 993 999 } // if 994 1000 995 int check = f.wd - 1;1001 int check = f.wd - 2; 996 1002 if ( ! f.flags.rwd ) f.s[check] = '\0'; // insert sentinel 997 1003 len = fmt( is, fmtstr, f.s );
Note:
See TracChangeset
for help on using the changeset viewer.