OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkUtils.h" | 10 #include "SkUtils.h" |
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 /////////////////////////////////////////////////////////////////////////////// | 399 /////////////////////////////////////////////////////////////////////////////// |
400 | 400 |
401 #include <stdlib.h> | 401 #include <stdlib.h> |
402 | 402 |
403 #if 0 | 403 #if 0 |
404 static int round_to_K(size_t bytes) { | 404 static int round_to_K(size_t bytes) { |
405 return (bytes + 512) >> 10; | 405 return (bytes + 512) >> 10; |
406 } | 406 } |
407 #endif | 407 #endif |
408 | 408 |
409 SkAutoMemoryUsageProbe::SkAutoMemoryUsageProbe(const char label[]) | 409 SkAutoMemoryUsageProbe::SkAutoMemoryUsageProbe(const char label[]) { |
410 : fLabel(label) { | |
411 #if 0 | 410 #if 0 |
412 struct mallinfo mi = mallinfo(); | 411 struct mallinfo mi = mallinfo(); |
413 | 412 |
414 fBytesAllocated = mi.uordblks; | 413 fBytesAllocated = mi.uordblks; |
415 #endif | 414 #endif |
416 } | 415 } |
417 | 416 |
418 SkAutoMemoryUsageProbe::~SkAutoMemoryUsageProbe() { | 417 SkAutoMemoryUsageProbe::~SkAutoMemoryUsageProbe() { |
419 #if 0 | 418 #if 0 |
420 struct mallinfo mi = mallinfo(); | 419 struct mallinfo mi = mallinfo(); |
421 | 420 |
422 printf("SkAutoMemoryUsageProbe "); | 421 printf("SkAutoMemoryUsageProbe "); |
423 if (fLabel) { | 422 if (fLabel) { |
424 printf("<%s> ", fLabel); | 423 printf("<%s> ", fLabel); |
425 } | 424 } |
426 printf("delta %dK, current total allocated %dK\n", | 425 printf("delta %dK, current total allocated %dK\n", |
427 round_to_K(mi.uordblks - fBytesAllocated), | 426 round_to_K(mi.uordblks - fBytesAllocated), |
428 round_to_K(mi.uordblks)); | 427 round_to_K(mi.uordblks)); |
429 #endif | 428 #endif |
430 } | 429 } |
OLD | NEW |