Changeset c8ec58e for libcfa


Ignore:
Timestamp:
Sep 11, 2023, 12:55:49 PM (13 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
c0035fc
Parents:
9509d67a (diff), 73d0a84c (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.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

Location:
libcfa
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • libcfa/prelude/extras.c

    r9509d67a rc8ec58e  
    33#include <uchar.h>                                      // char16_t, char32_t
    44#include <wchar.h>                                      // wchar_t
    5 #include <stdlib.h>                                     // malloc, free, exit, atexit, abort
     5#include <stdlib.h>                                     // malloc, free, getenv, exit, atexit, abort, printf
    66#include <stdio.h>                                      // printf
     7#include <string.h>                                     // strlen, strcmp, strncmp
  • libcfa/prelude/extras.regx2

    r9509d67a rc8ec58e  
    11extern void \*malloc[^;]*;
    22extern void free[^;]*;
     3extern char \*getenv[^;]*;
    34extern void exit[^;]*;
    45extern int atexit[^;]*;
    56extern void abort[^;]*;
    67extern int printf[^;]*;
     8int strcmp[^;]*;
     9int strncmp[^;]*;
     10size_t strlen[^;]*;
  • libcfa/src/clock.hfa

    r9509d67a rc8ec58e  
    1010// Created On       : Thu Apr 12 14:36:06 2018
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Apr 18 08:12:16 2021
    13 // Update Count     : 28
     12// Last Modified On : Sat Sep  9 14:07:17 2023
     13// Update Count     : 30
    1414//
    1515
     
    9191        // discontinuous jumps when the OS is not running the kernal thread. A duration is returned because the value is
    9292        // relative and cannot be converted to real-time (wall-clock) time.
    93         Duration processor() {                                                          // non-monotonic duration of kernel thread
     93        Duration processor_cpu() {                                                      // non-monotonic duration of kernel thread
    9494                timespec ts;
    9595                clock_gettime( CLOCK_THREAD_CPUTIME_ID, &ts );
    9696                return (Duration){ ts };
    97         } // processor
     97        } // processor_cpu
    9898
    9999        // Program CPU-time watch measures CPU time consumed by all processors (kernel threads) in the UNIX process.  This
    100100        // watch is affected by discontinuous jumps when the OS is not running the kernel threads. A duration is returned
    101101        // because the value is relative and cannot be converted to real-time (wall-clock) time.
    102         Duration program() {                                                            // non-monotonic duration of program CPU
     102        Duration program_cpu() {                                                        // non-monotonic duration of program CPU
    103103                timespec ts;
    104104                clock_gettime( CLOCK_PROCESS_CPUTIME_ID, &ts );
    105105                return (Duration){ ts };
    106         } // program
     106        } // program_cpu
    107107
    108108        // Monotonic duration from machine boot and including system suspension. This watch is unaffected by discontinuous
  • libcfa/src/concurrency/kernel/cluster.hfa

    r9509d67a rc8ec58e  
    3131
    3232// 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 )
    3535
    3636// 8X linear factor is just 8 * x
     
    4242static 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); }
    4343
    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 ); \
    4646verify(ret >= 0)
    4747
  • libcfa/src/heap.cfa

    r9509d67a rc8ec58e  
    1010// Created On       : Tue Dec 19 21:58:35 2017
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Aug  2 18:48:30 2023
    13 // Update Count     : 1614
     12// Last Modified On : Mon Sep 11 11:21:10 2023
     13// Update Count     : 1615
    1414//
    1515
     
    691691        return stats;
    692692} // collectStats
     693
     694static 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
    693705#endif // __STATISTICS__
    694706
     
    15561568
    15571569
     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
    15581583        // Changes the file descriptor where malloc_stats() writes statistics.
    15591584        int malloc_stats_fd( int fd __attribute__(( unused )) ) libcfa_public {
  • libcfa/src/heap.hfa

    r9509d67a rc8ec58e  
    1010// Created On       : Tue May 26 11:23:55 2020
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Oct  4 19:08:55 2022
    13 // Update Count     : 23
     12// Last Modified On : Mon Sep 11 11:18:18 2023
     13// Update Count     : 24
    1414//
    1515
     
    4343        size_t malloc_mmap_start();                                                     // crossover allocation size from sbrk to mmap
    4444        size_t malloc_unfreed();                                                        // heap unfreed size (bytes)
     45        void malloc_stats_clear();                                                      // clear heap statistics
    4546} // extern "C"
    4647
  • libcfa/src/iostream.cfa

    r9509d67a rc8ec58e  
     1
    12//
    23// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     
    976977                if ( f.flags.ignore ) { fmtstr[1] = '*'; start += 1; }
    977978                // 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                }
    979985
    980986                if ( ! scanset ) {
     
    993999                } // if
    9941000
    995                 int check = f.wd - 1;
     1001                int check = f.wd - 2;
    9961002                if ( ! f.flags.rwd ) f.s[check] = '\0';                 // insert sentinel
    9971003                len = fmt( is, fmtstr, f.s );
Note: See TracChangeset for help on using the changeset viewer.