| 1 |
/* praat_statistics.cpp |
| 2 |
* |
| 3 |
* Copyright (C) 1992-2012,2014-2022,2024-2026 Paul Boersma & David Weenink |
| 4 |
* |
| 5 |
* This code is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 3 of the License, or (at |
| 8 |
* your option) any later version. |
| 9 |
* |
| 10 |
* This code is distributed in the hope that it will be useful, but |
| 11 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
| 13 |
* See the GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this work. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
*/ |
| 18 |
|
| 19 |
#include <time.h> |
| 20 |
#include <locale.h> |
| 21 |
#include <thread> |
| 22 |
#if defined (macintosh) |
| 23 |
#include <pwd.h> |
| 24 |
#endif |
| 25 |
#include "praatP.h" |
| 26 |
#include "GraphicsP.h" |
| 27 |
#include "NUMmachar.h" |
| 28 |
|
| 29 |
static struct { |
| 30 |
integer batchSessions, interactiveSessions; |
| 31 |
double memory; |
| 32 |
PrefsString dateOfFirstSession; |
| 33 |
} statistics; |
| 34 |
|
| 35 |
void praat_statistics_prefs () { |
| 36 |
Preferences_addInteger (U"PraatShell.batchSessions", & statistics.batchSessions, 0); |
| 37 |
Preferences_addInteger (U"PraatShell.interactiveSessions", & statistics.interactiveSessions, 0); |
| 38 |
Preferences_addDouble (U"PraatShell.memory", & statistics.memory, 0.0); |
| 39 |
Preferences_addString (U"PraatShell.dateOfFirstSession", & statistics.dateOfFirstSession [0], U""); |
| 40 |
} |
| 41 |
|
| 42 |
void praat_statistics_prefsChanged () { |
| 43 |
if (! statistics.dateOfFirstSession [0]) { |
| 44 |
time_t today = time (nullptr); |
| 45 |
char32 *newLine; |
| 46 |
str32cpy (statistics.dateOfFirstSession, Melder_peek8to32_u (ctime (& today))); |
| 47 |
newLine = str32chr (statistics.dateOfFirstSession, U'\n'); |
| 48 |
if (newLine) *newLine = '\0'; |
| 49 |
} |
| 50 |
if (theCurrentPraatApplication -> batch) |
| 51 |
statistics.batchSessions += 1; |
| 52 |
else |
| 53 |
statistics.interactiveSessions += 1; |
| 54 |
} |
| 55 |
|
| 56 |
void praat_statistics_exit () { |
| 57 |
statistics.memory += Melder_allocationSize (); |
| 58 |
} |
| 59 |
|
| 60 |
/*@praat |
| 61 |
report$ = Report integer properties |
| 62 |
sizeOfInteger = extractNumber (report$, "An indexing integer is ") |
| 63 |
sizeOfPointer = extractNumber (report$, "A pointer is ") |
| 64 |
assert sizeOfInteger = sizeOfPointer |
| 65 |
sizeOfFileOffset = extractNumber (report$, "A file offset is ") |
| 66 |
assert sizeOfFileOffset = 64 |
| 67 |
@*/ |
| 68 |
void praat_reportIntegerProperties () { |
| 69 |
MelderInfo_open (); |
| 70 |
MelderInfo_writeLine (U"Integer properties of this edition of Praat on this computer:\n"); |
| 71 |
MelderInfo_writeLine (U"A boolean is ", sizeof (bool) * 8, U" bits."); |
| 72 |
MelderInfo_writeLine (U"A \"short integer\" is ", sizeof (short) * 8, U" bits."); |
| 73 |
MelderInfo_writeLine (U"An \"integer\" is ", sizeof (int) * 8, U" bits."); |
| 74 |
MelderInfo_writeLine (U"A \"long integer\" is ", sizeof (long) * 8, U" bits."); |
| 75 |
MelderInfo_writeLine (U"A \"long long integer\" is ", sizeof (long long) * 8, U" bits."); |
| 76 |
MelderInfo_writeLine (U"An indexing integer is ", sizeof (integer) * 8, U" bits."); |
| 77 |
MelderInfo_writeLine (U"A pointer is ", sizeof (void *) * 8, U" bits."); |
| 78 |
MelderInfo_writeLine (U"A memory object size is ", sizeof (size_t) * 8, U" bits."); |
| 79 |
MelderInfo_writeLine (U"A file offset is ", sizeof (off_t) * 8, U" bits."); |
| 80 |
MelderInfo_close (); |
| 81 |
} |
| 82 |
|
| 83 |
void praat_reportFloatingPointProperties () { |
| 84 |
if (! NUMfpp) |
| 85 |
NUMmachar (); |
| 86 |
MelderInfo_open (); |
| 87 |
MelderInfo_writeLine (U"Double precision floating point properties of this machine,"); |
| 88 |
MelderInfo_writeLine (U"as calculated by algorithms from the Binary Linear Algebra System (BLAS)"); |
| 89 |
MelderInfo_writeLine (U"\nRadix: ", NUMfpp -> base); |
| 90 |
MelderInfo_writeLine (U"Number of digits in mantissa: ", NUMfpp -> t); |
| 91 |
MelderInfo_writeLine (U"Smallest exponent before (gradual) underflow (expmin): ", NUMfpp -> emin); |
| 92 |
MelderInfo_writeLine (U"Largest exponent before overflow (expmax): ", NUMfpp -> emax); |
| 93 |
MelderInfo_writeLine (U"Does rounding occur in addition: ", (NUMfpp -> rnd == 1 ? U"yes" : U"no")); |
| 94 |
MelderInfo_writeLine (U"Quantization step (d): ", NUMfpp -> prec); |
| 95 |
MelderInfo_writeLine (U"Quantization error (eps = d/2): ", NUMfpp -> eps); |
| 96 |
MelderInfo_writeLine (U"Underflow threshold (= radix ^ (expmin - 1)): ", NUMfpp -> rmin); |
| 97 |
MelderInfo_writeLine (U"Safe minimum (such that its inverse does not overflow): ", NUMfpp -> sfmin); |
| 98 |
MelderInfo_writeLine (U"Overflow threshold (= (1 - eps) * radix ^ expmax): ", NUMfpp -> rmax); |
| 99 |
MelderInfo_writeLine (U"\nA long double is ", sizeof (long double), U" bytes"); |
| 100 |
MelderInfo_writeLine (U"A longdouble is ", sizeof (longdouble), U" bytes"); |
| 101 |
MelderInfo_close (); |
| 102 |
} |
| 103 |
|
| 104 |
void praat_reportTextProperties () { |
| 105 |
MelderInfo_open (); |
| 106 |
MelderInfo_writeLine (U"Text properties of this edition of Praat on this computer:\n"); |
| 107 |
MelderInfo_writeLine (U"Locale: ", Melder_peek8to32_u (setlocale (LC_ALL, nullptr))); |
| 108 |
MelderInfo_writeLine (U"A \"char\" is ", 8, U" bits."); |
| 109 |
constexpr bool charIsSigned = ( (int) (char) 200 < 0 ); |
| 110 |
if (charIsSigned) |
| 111 |
MelderInfo_writeLine (U"A \"char\" is ", charIsSigned ? U"signed." : U"unsigned."); |
| 112 |
MelderInfo_writeLine (U"A \"char16_t\" is ", sizeof (char16_t) * 8, U" bits."); |
| 113 |
MelderInfo_writeLine (U"A \"wchar_t\" is ", sizeof (wchar_t) * 8, U" bits."); |
| 114 |
if constexpr ((wchar_t) -1 < 0) |
| 115 |
MelderInfo_writeLine (U"A \"wchar_t\" is signed."); |
| 116 |
else |
| 117 |
MelderInfo_writeLine (U"A \"wchar_t\" is unsigned."); |
| 118 |
MelderInfo_writeLine (U"A \"char32_t\" is ", sizeof (char32_t) * 8, U" bits."); |
| 119 |
MelderInfo_close (); |
| 120 |
} |
| 121 |
|
| 122 |
#if defined (macintosh) |
| 123 |
static bool isSandboxed () { |
| 124 |
//return !! NSProcessInfo.processInfo.environment [@"APP_SANDBOX_CONTAINER_ID"]; |
| 125 |
return !! Melder_getenv (U"APP_SANDBOX_CONTAINER_ID"); |
| 126 |
} |
| 127 |
static kleenean hasFullDiskAccess () { |
| 128 |
if (Melder_systemVersion < 101400) |
| 129 |
return kleenean_YES; |
| 130 |
NSFileManager *nsFileManager = [NSFileManager defaultManager]; |
| 131 |
//NSWorkspace *nsWorkspace = [NSWorkspace sharedWorkspace]; |
| 132 |
// to open the preferences at Full Disk Access: [nsWorkspace openURL: [NSURL URLWithString: @"x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"]]; |
| 133 |
NSString *nsUserHomeFolderPath; |
| 134 |
if (isSandboxed ()) { |
| 135 |
struct passwd *password = getpwuid (getuid ()); |
| 136 |
Melder_assert (!! password); |
| 137 |
nsUserHomeFolderPath = [NSString stringWithUTF8String: password -> pw_dir]; |
| 138 |
} else { |
| 139 |
nsUserHomeFolderPath = NSHomeDirectory (); |
| 140 |
} |
| 141 |
NSString *perhapsUnreadableFilePath = ( Melder_systemVersion < 101500 ? |
| 142 |
[nsUserHomeFolderPath stringByAppendingPathComponent: @"Library/Safari/Bookmarks.plist"] : |
| 143 |
[nsUserHomeFolderPath stringByAppendingPathComponent: @"Library/Safari/CloudTabs.db"] |
| 144 |
); |
| 145 |
structMelderFile file { }; |
| 146 |
Melder_pathToFile (Melder_peek8to32_u ([perhapsUnreadableFilePath UTF8String]), & file); |
| 147 |
if (! MelderFile_exists (& file)) |
| 148 |
return kleenean_UNKNOWN; |
| 149 |
if (! MelderFile_readable (& file)) |
| 150 |
return kleenean_NO; |
| 151 |
return kleenean_YES; |
| 152 |
} |
| 153 |
static NSString *getRealHomeDirectory () { |
| 154 |
NSString *nsUserHomeFolderPath; |
| 155 |
if (isSandboxed ()) { |
| 156 |
struct passwd *password = getpwuid (getuid ()); |
| 157 |
Melder_assert (!! password); |
| 158 |
nsUserHomeFolderPath = [NSString stringWithUTF8String: password -> pw_dir]; |
| 159 |
} else { |
| 160 |
nsUserHomeFolderPath = NSHomeDirectory (); |
| 161 |
} |
| 162 |
return nsUserHomeFolderPath; |
| 163 |
} |
| 164 |
#endif // defined (macintosh) |
| 165 |
|
| 166 |
void praat_reportSystemProperties () { |
| 167 |
MelderInfo_open (); |
| 168 |
MelderInfo_writeLine (U"System properties of this edition of Praat on this computer:\n"); |
| 169 |
#ifdef _WIN32 |
| 170 |
MelderInfo_writeLine (U"_WIN32 is \"" stringize(_WIN32) "\"."); |
| 171 |
#endif |
| 172 |
#ifdef WINVER |
| 173 |
MelderInfo_writeLine (U"WINVER is \"" stringize(WINVER) "\"."); |
| 174 |
#endif |
| 175 |
#ifdef _WIN32_WINNT |
| 176 |
MelderInfo_writeLine (U"_WIN32_WINNT is \"" stringize(_WIN32_WINNT) "\"."); |
| 177 |
#endif |
| 178 |
#ifdef _WIN32_IE |
| 179 |
MelderInfo_writeLine (U"_WIN32_IE is \"" stringize(_WIN32_IE) "\"."); |
| 180 |
#endif |
| 181 |
#ifdef UNICODE |
| 182 |
MelderInfo_writeLine (U"UNICODE is \"" stringize(UNICODE) "\"."); |
| 183 |
#endif |
| 184 |
#ifdef _FILE_OFFSET_BITS |
| 185 |
MelderInfo_writeLine (U"_FILE_OFFSET_BITS is \"" stringize(_FILE_OFFSET_BITS) "\"."); |
| 186 |
#endif |
| 187 |
#ifdef macintosh |
| 188 |
MelderInfo_writeLine (U"macintosh is \"" stringize(macintosh) "\"."); |
| 189 |
#endif |
| 190 |
#ifdef linux |
| 191 |
MelderInfo_writeLine (U"linux is \"" stringize(linux) "\"."); |
| 192 |
#endif |
| 193 |
MelderInfo_writeLine (U"Maximum number of concurrent threads: ", std::thread::hardware_concurrency(), U"."); |
| 194 |
#ifdef macintosh |
| 195 |
MelderInfo_writeLine (U"system version is ", Melder_systemVersion, U"."); |
| 196 |
#endif |
| 197 |
#ifdef linux |
| 198 |
MelderInfo_writeLine (U"Display protocol: probably ", Melder_systemVersion == 'w' ? U"Wayland" : U"X11", U" (but use xeyes to make sure)."); |
| 199 |
#endif |
| 200 |
#if defined (__aarch64__) || defined (_M_ARM64_) |
| 201 |
MelderInfo_writeLine (U"Built for processor type: ", U"arm64"); |
| 202 |
#elif defined (__s390x__) |
| 203 |
MelderInfo_writeLine (U"Built for processor type: ", U"s390x"); |
| 204 |
#elif defined (raspberrypi) |
| 205 |
MelderInfo_writeLine (U"Built for processor type: ", U"armv7"); |
| 206 |
#else |
| 207 |
MelderInfo_writeLine (U"Built for processor type: ", sizeof (void *) == 4 ? U"intel32" : U"intel64"); |
| 208 |
#endif |
| 209 |
#if defined (__ARM_ARCH) |
| 210 |
MelderInfo_writeLine (U"__ARM_ARCH: defined"); |
| 211 |
#else |
| 212 |
MelderInfo_writeLine (U"__ARM_ARCH: undefined"); |
| 213 |
#endif |
| 214 |
#if defined (__ARM_NEON) |
| 215 |
MelderInfo_writeLine (U"__ARM_NEON: defined"); |
| 216 |
#else |
| 217 |
MelderInfo_writeLine (U"__ARM_NEON: undefined"); |
| 218 |
#endif |
| 219 |
structMelderFolder homeFolder {}; |
| 220 |
Melder_getHomeDir (& homeFolder); |
| 221 |
MelderInfo_writeLine (U"Home folder: ", MelderFolder_peekPath (& homeFolder)); |
| 222 |
#ifdef macintosh |
| 223 |
MelderInfo_writeLine (U"Full Disk Access: ", Melder_kleenean (hasFullDiskAccess ())); |
| 224 |
MelderInfo_writeLine (U"Sandboxed: ", Melder_boolean (isSandboxed ())); |
| 225 |
if (isSandboxed ()) |
| 226 |
MelderInfo_writeLine (U"Sandbox (application home) folder: ", Melder_peek8to32_u ([NSHomeDirectory () UTF8String])); |
| 227 |
MelderInfo_writeLine (U"User home folder: ", Melder_peek8to32_u ([getRealHomeDirectory () UTF8String])); |
| 228 |
NSRunningApplication *currentApplication = [NSRunningApplication currentApplication]; |
| 229 |
pid_t processID = [currentApplication processIdentifier]; |
| 230 |
Melder_assert (processID == getpid()); |
| 231 |
MelderInfo_writeLine (U"Process ID: ", processID); |
| 232 |
MelderInfo_writeLine (U"Localized app name: ", Melder_peek8to32_u ([[currentApplication localizedName] UTF8String])); |
| 233 |
MelderInfo_writeLine (U"App bundle identifier: ", Melder_peek8to32_u ([[currentApplication bundleIdentifier] UTF8String])); |
| 234 |
#endif // macintosh |
| 235 |
#ifdef _WIN32 |
| 236 |
MelderInfo_writeLine (U"SM_CXFIXEDFRAME: ", GetSystemMetrics (SM_CXFIXEDFRAME)); |
| 237 |
MelderInfo_writeLine (U"SM_CYFIXEDFRAME: ", GetSystemMetrics (SM_CYFIXEDFRAME)); |
| 238 |
MelderInfo_writeLine (U"SM_CXSIZEFRAME: ", GetSystemMetrics (SM_CXSIZEFRAME)); |
| 239 |
MelderInfo_writeLine (U"SM_CYSIZEFRAME: ", GetSystemMetrics (SM_CYSIZEFRAME)); |
| 240 |
MelderInfo_writeLine (U"SM_CYCAPTION: ", GetSystemMetrics (SM_CYCAPTION)); |
| 241 |
MelderInfo_writeLine (U"SM_CYMENU: ", GetSystemMetrics (SM_CYMENU)); |
| 242 |
#endif // _WIN32 |
| 243 |
MelderInfo_close (); |
| 244 |
} |
| 245 |
|
| 246 |
void praat_reportAppProperties () { |
| 247 |
MelderInfo_open (); |
| 248 |
MelderInfo_writeLine (U"Upper-case app name: ", Melder_upperCaseAppName()); |
| 249 |
MelderInfo_writeLine (U"Lower-case app name: ", Melder_lowerCaseAppName()); |
| 250 |
MelderInfo_writeLine (U"App version (as a number): ", Melder_appVersion()); |
| 251 |
MelderInfo_writeLine (U"App version (as text): ", Melder_appVersionSTR()); |
| 252 |
MelderInfo_writeLine (U"App year: ", Melder_appYear()); |
| 253 |
MelderInfo_writeLine (U"App month (as a number): ", Melder_appMonth()); |
| 254 |
MelderInfo_writeLine (U"App month (as text): ", Melder_appMonthSTR()); |
| 255 |
MelderInfo_writeLine (U"App day: ", Melder_appDay()); |
| 256 |
MelderInfo_writeLine (U"App contact address: ", Melder_appContactAddress()); |
| 257 |
MelderInfo_close (); |
| 258 |
} |
| 259 |
|
| 260 |
void praat_reportGraphicalProperties () { |
| 261 |
MelderInfo_open (); |
| 262 |
MelderInfo_writeLine (U"Graphical properties of this edition of Praat on this computer:\n"); |
| 263 |
double x, y, width, height; |
| 264 |
Gui_getWindowPositioningBounds (& x, & y, & width, & height); |
| 265 |
MelderInfo_writeLine (U"Window positioning area: x = ", x, U", y = ", y, |
| 266 |
U", width = ", width, U", height = ", height); |
| 267 |
#if defined (macintosh) |
| 268 |
CGDirectDisplayID screen = CGMainDisplayID (); |
| 269 |
CGSize screenSize_mm = CGDisplayScreenSize (screen); |
| 270 |
const double diagonal_mm = hypot (screenSize_mm. width, screenSize_mm. height); |
| 271 |
const double diagonal_inch = diagonal_mm / 25.4; |
| 272 |
MelderInfo_writeLine (U"\nScreen size: ", screenSize_mm. width, U" x ", screenSize_mm. height, |
| 273 |
U" mm (diagonal ", Melder_fixed (diagonal_mm, 1), U" mm = ", Melder_fixed (diagonal_inch, 1), U" inch)"); |
| 274 |
const size_t screenWidth_pixels = CGDisplayPixelsWide (screen); |
| 275 |
const size_t screenHeight_pixels = CGDisplayPixelsHigh (screen); |
| 276 |
MelderInfo_writeLine (U"Screen \"resolution\": ", screenWidth_pixels, U" x ", screenHeight_pixels, U" pixels"); |
| 277 |
const double resolution = 25.4 * screenWidth_pixels / screenSize_mm. width; |
| 278 |
MelderInfo_writeLine (U"Screen resolution: ", Melder_fixed (resolution, 1), U" pixels/inch"); |
| 279 |
#elif defined (_WIN32) |
| 280 |
/*for (int i = 0; i <= 88; i ++) |
| 281 |
MelderInfo_writeLine (U"System metric ", i, U": ", GetSystemMetrics (i));*/ |
| 282 |
#endif |
| 283 |
MelderInfo_close (); |
| 284 |
} |
| 285 |
|
| 286 |
#if cairo |
| 287 |
static void testFont (PangoFontMap *pangoFontMap, PangoContext *pangoContext, conststring32 fontName) { |
| 288 |
PangoFontDescription *pangoFontDescription = pango_font_description_from_string (Melder_peek32to8 (fontName)); |
| 289 |
PangoFont *pangoFont = pango_font_map_load_font (pangoFontMap, pangoContext, pangoFontDescription); |
| 290 |
PangoFontDescription *pangoFontDescription2 = pango_font_describe (pangoFont); |
| 291 |
const char *familyName = pango_font_description_get_family (pangoFontDescription2); |
| 292 |
MelderInfo_writeLine (U"Asking for font ", fontName, U" gives ", Melder_peek8to32_u (familyName), U"."); |
| 293 |
} |
| 294 |
#endif // cairo |
| 295 |
void praat_reportFontProperties () { |
| 296 |
MelderInfo_open (); |
| 297 |
MelderInfo_writeLine (U"Font replacement on this computer:\n"); |
| 298 |
#if cairo |
| 299 |
PangoFontMap *pangoFontMap = pango_cairo_font_map_get_default (); |
| 300 |
PangoContext *pangoContext = pango_font_map_create_context (pangoFontMap); |
| 301 |
conststring32 fontNames [] = { U"Times", U"Roman", U"Serif", |
| 302 |
U"Helvetica", U"Arial", U"Sans", |
| 303 |
U"Courier", U"Courier New", U"Mono", U"Monospace", |
| 304 |
U"Palatino", U"Palladio", |
| 305 |
U"Doulos", U"Doulos SIL", U"Charis", U"Charis SIL", |
| 306 |
U"Symbol", U"Dingbats", |
| 307 |
nullptr |
| 308 |
}; |
| 309 |
for (conststring32 *fontName = & fontNames [0]; !! *fontName; fontName ++) |
| 310 |
testFont (pangoFontMap, pangoContext, *fontName); |
| 311 |
g_object_unref (pangoContext); |
| 312 |
|
| 313 |
MelderInfo_writeLine (U"\nAll fonts on this computer:\n"); |
| 314 |
PangoFontFamily **families; |
| 315 |
int numberOfFamilies; |
| 316 |
pango_font_map_list_families (pangoFontMap, & families, & numberOfFamilies); |
| 317 |
for (int i = 0; i < numberOfFamilies; i ++) |
| 318 |
MelderInfo_writeLine (i, U" ", Melder_peek8to32_u (pango_font_family_get_name (families [i]))); |
| 319 |
g_free (families); |
| 320 |
#endif // cairo |
| 321 |
MelderInfo_close (); |
| 322 |
} |
| 323 |
|
| 324 |
void praat_reportMemoryUse () { |
| 325 |
MelderInfo_open (); |
| 326 |
MelderInfo_writeLine (U"Memory use by Praat:\n"); |
| 327 |
MelderInfo_writeLine (U"Currently in use:\n" |
| 328 |
U" Strings: ", MelderString_allocationCount () - MelderString_deallocationCount (), |
| 329 |
U" (", Melder_bigInteger (MelderString_allocationSize () - MelderString_deallocationSize ()), U" characters)"); |
| 330 |
MelderInfo_writeLine ( |
| 331 |
U" Arrays: ", MelderArray_allocationCount () - MelderArray_deallocationCount (), |
| 332 |
U" (", Melder_bigInteger (MelderArray_cellAllocationCount () - MelderArray_cellDeallocationCount ()), U" cells)"); |
| 333 |
MelderInfo_writeLine (U" Things: ", theTotalNumberOfThings + 0, |
| 334 |
U" (objects in list: ", Melder_bigInteger (theCurrentPraatObjects -> n), U")"); |
| 335 |
integer numberOfMotifWidgets = |
| 336 |
#if motif |
| 337 |
Gui_getNumberOfMotifWidgets (); |
| 338 |
MelderInfo_writeLine (U" Motif widgets: ", Melder_bigInteger (numberOfMotifWidgets)); |
| 339 |
#else |
| 340 |
0; |
| 341 |
#endif |
| 342 |
MelderInfo_writeLine (U" Other: ", |
| 343 |
Melder_allocationCount () - Melder_deallocationCount () |
| 344 |
- theTotalNumberOfThings |
| 345 |
- (MelderString_allocationCount () - MelderString_deallocationCount ()) |
| 346 |
- (MelderArray_allocationCount () - MelderArray_deallocationCount ()) |
| 347 |
- numberOfMotifWidgets |
| 348 |
); |
| 349 |
MelderInfo_writeLine ( |
| 350 |
U"\nMemory history of this session:\n" |
| 351 |
U" Total created: ", Melder_bigInteger (Melder_allocationCount ()), U" (", Melder_bigInteger (Melder_allocationSize ()), U" bytes)"); |
| 352 |
MelderInfo_writeLine (U" Total deleted: ", Melder_bigInteger (Melder_deallocationCount ())); |
| 353 |
MelderInfo_writeLine (U" Reallocations: ", Melder_bigInteger (Melder_movingReallocationsCount ()), U" moving, ", |
| 354 |
Melder_bigInteger (Melder_reallocationsInSituCount ()), U" in situ"); |
| 355 |
MelderInfo_writeLine ( |
| 356 |
U" Strings created: ", Melder_bigInteger (MelderString_allocationCount ()), |
| 357 |
U" (", Melder_bigInteger (MelderString_allocationSize ()), U" characters)"); |
| 358 |
MelderInfo_writeLine ( |
| 359 |
U" Strings deleted: ", Melder_bigInteger (MelderString_deallocationCount ()), |
| 360 |
U" (", Melder_bigInteger (MelderString_deallocationSize ()), U" characters)"); |
| 361 |
MelderInfo_writeLine ( |
| 362 |
U" Arrays created: ", Melder_bigInteger (MelderArray_allocationCount ()), |
| 363 |
U" (", Melder_bigInteger (MelderArray_cellAllocationCount ()), U" cells)"); |
| 364 |
MelderInfo_writeLine ( |
| 365 |
U" Arrays deleted: ", Melder_bigInteger (MelderArray_deallocationCount ()), |
| 366 |
U" (", Melder_bigInteger (MelderArray_cellDeallocationCount ()), U" cells)"); |
| 367 |
MelderInfo_writeLine (U"\nHistory of all sessions from ", statistics.dateOfFirstSession, U" until today:"); |
| 368 |
MelderInfo_writeLine (U" Sessions: ", Melder_bigInteger (statistics.interactiveSessions), U" interactive, ", |
| 369 |
Melder_bigInteger (statistics.batchSessions), U" batch"); |
| 370 |
MelderInfo_writeLine (U" Total memory use: ", Melder_bigInteger ((int64) statistics.memory + Melder_allocationSize ()), U" bytes"); |
| 371 |
MelderInfo_writeLine (U"\nNumber of fixed menu commands: ", Melder_bigInteger (praat_getNumberOfMenuCommands ())); |
| 372 |
MelderInfo_writeLine (U"Number of dynamic menu commands: ", Melder_bigInteger (praat_getNumberOfActions ())); |
| 373 |
MelderInfo_close (); |
| 374 |
} |
| 375 |
|
| 376 |
void MelderCasual_memoryUse (integer message) { |
| 377 |
integer numberOfStrings = MelderString_allocationCount () - MelderString_deallocationCount (); |
| 378 |
integer numberOfArrays = MelderArray_allocationCount () - MelderArray_deallocationCount (); |
| 379 |
integer numberOfThings = theTotalNumberOfThings; |
| 380 |
integer numberOfOther = Melder_allocationCount () - Melder_deallocationCount () |
| 381 |
- numberOfStrings - numberOfArrays - numberOfThings; |
| 382 |
Melder_casual (U"Memory ", message, U": ", |
| 383 |
numberOfStrings, U" strings, ", numberOfArrays, U" arrays, ", numberOfThings, U" things, ", numberOfOther, U" other."); |
| 384 |
} |
| 385 |
|
| 386 |
/* End of file praat_statistics.cpp */ |