Changeset 8245
- Timestamp:
- Jan 22, 2008, 10:15:44 PM (17 years ago)
- Location:
- trunk/source/lisp-kernel
- Files:
-
- 3 edited
-
gc-common.c (modified) (5 diffs)
-
gc.h (modified) (1 diff)
-
pmcl-kernel.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/lisp-kernel/gc-common.c
r8202 r8245 26 26 #include <sys/time.h> 27 27 28 #ifndef timeradd 29 # define timeradd(a, b, result) \ 30 do { \ 31 (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ 32 (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ 33 if ((result)->tv_usec >= 1000000) \ 34 { \ 35 ++(result)->tv_sec; \ 36 (result)->tv_usec -= 1000000; \ 37 } \ 38 } while (0) 39 #endif 40 #ifndef timersub 41 # define timersub(a, b, result) \ 42 do { \ 43 (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ 44 (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ 45 if ((result)->tv_usec < 0) { \ 46 --(result)->tv_sec; \ 47 (result)->tv_usec += 1000000; \ 48 } \ 49 } while (0) 50 #endif 51 52 void 53 comma_output_decimal(char *buf, int len, natural n) 54 { 55 int nout = 0; 56 57 buf[--len] = 0; 58 do { 59 buf[--len] = n%10+'0'; 60 n = n/10; 61 if (n == 0) { 62 while (len) { 63 buf[--len] = ' '; 64 } 65 return; 66 } 67 if (len == 0) return; 68 nout ++; 69 if (nout == 3) { 70 buf[--len] = ','; 71 nout = 0; 72 } 73 } while (len >= 0); 74 } 28 75 29 76 … … 794 841 area *a = active_dynamic_area, *to = NULL, *from = NULL, *note = NULL; 795 842 unsigned timeidx = 1; 843 paging_info paging_info_start; 796 844 xframe_list *x; 797 845 LispObj … … 846 894 847 895 if (GCverbose) { 896 char buf[16]; 897 898 sample_paging_info(&paging_info_start); 899 comma_output_decimal(buf,16,area_dnode(oldfree,a->low) << dnode_shift); 848 900 if (GCephemeral_low) { 849 901 fprintf(stderr, … … 853 905 fprintf(stderr,"\n\n;;; Starting full GC"); 854 906 } 855 fprintf(stderr, ", %ld bytes allocated.\n", area_dnode(oldfree,a->low) << dnode_shift);907 fprintf(stderr, ", %s bytes allocated.\n", buf); 856 908 } 857 909 … … 1148 1200 *( (long long *) ptr_from_lispobj(((macptr *) ptr_from_lispobj(untag(val)))->address)) += justfreed; 1149 1201 if (GCverbose) { 1202 char buf[16]; 1203 paging_info paging_info_stop; 1204 1205 sample_paging_info(&paging_info_stop); 1150 1206 if (justfreed <= heap_segment_size) { 1151 1207 justfreed = 0; 1152 1208 } 1209 comma_output_decimal(buf,16,justfreed); 1153 1210 if (note == tenured_area) { 1154 fprintf(stderr,";;; Finished full GC. Freed %lld bytes in %d.%06d s\n\n", justfreed, elapsed.tv_sec, elapsed.tv_usec);1211 fprintf(stderr,";;; Finished full GC. %s bytes freed in %d.%06d s\n\n", buf, elapsed.tv_sec, elapsed.tv_usec); 1155 1212 } else { 1156 fprintf(stderr,";;; Finished E phemeral GC of generation %d. Freed %lld bytesin %d.%06d s\n\n",1213 fprintf(stderr,";;; Finished EGC of generation %d. %s bytes freed in %d.%06d s\n\n", 1157 1214 (from == g2_area) ? 2 : (from == g1_area) ? 1 : 0, 1158 justfreed,1215 buf, 1159 1216 elapsed.tv_sec, elapsed.tv_usec); 1160 1217 } 1161 } 1162 } 1163 } 1164 } 1218 report_paging_info_delta(stderr, &paging_info_start, &paging_info_stop); 1219 } 1220 } 1221 } 1222 } -
trunk/source/lisp-kernel/gc.h
r7644 r8245 111 111 #define VOID_ALLOCPTR ((LispObj)(-dnode_size)) 112 112 #endif 113 114 #ifdef DARWIN 115 #include <mach/task_info.h> 116 typedef struct task_events_info paging_info; 117 #else 118 #ifndef WINDOWS 119 #include <sys/resource.h> 120 typedef struct rusage paging_info; 121 #endif 122 #endif 123 124 #include <stdio.h> 125 126 void sample_paging_info(paging_info *); 127 void report_paging_info_delta(FILE*, paging_info *, paging_info *); 113 128 114 129 -
trunk/source/lisp-kernel/pmcl-kernel.c
r7668 r8245 1880 1880 1881 1881 1882 #ifdef DARWIN 1883 void 1884 sample_paging_info(paging_info *stats) 1885 { 1886 mach_msg_type_number_t count = TASK_EVENTS_INFO_COUNT; 1887 1888 task_info(mach_task_self(), 1889 TASK_EVENTS_INFO, 1890 (task_info_t)stats, 1891 &count); 1892 } 1893 1894 void 1895 report_paging_info_delta(FILE *out, paging_info *start, paging_info *stop) 1896 { 1897 fprintf(out,";;; %d soft faults, %d faults, %d pageins\n\n", 1898 stop->cow_faults-start->cow_faults, 1899 stop->faults-start->faults, 1900 stop->pageins-start->pageins); 1901 } 1902 1903 #else 1904 #ifndef WINDOWS 1905 void 1906 sample_paging_info(struct rusage *usage) 1907 { 1908 getrusage(RUSAGE_SELF, rusage); 1909 } 1910 1911 void 1912 report_paging_info_delta(FILE *out, paging_info *start, paging_info *stop) 1913 { 1914 fprintf(out,";;; %d soft faults, %d faults, %d pageins\n\n", 1915 stop->ru_minflt-start->ru_minflt, 1916 stop->ru_majflt-start->ru_majflt, 1917 stop->ru_nswap-start->ru_nswap); 1918 } 1919 1920 #endif 1921 #endif
Note:
See TracChangeset
for help on using the changeset viewer.
