/*
- * Copyright (c) 2014 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2014-2016 Apple Computer, Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
- *
+ *
* "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
* Reserved. This file contains Original Code and/or Modifications of
* Original Code as defined in and that are subject to the Apple Public
* except in compliance with the License. Please obtain a copy of the
* License at http://www.apple.com/publicsource and read it before using
* this file.
- *
+ *
* The Original Code and all software distributed under the License are
* distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
* License for the specific language governing rights and limitations
* under the License."
- *
+ *
* @APPLE_LICENSE_HEADER_END@
*/
fprintf (stderr, " -H : grab data for the HIB segment\n");
fprintf (stderr, " -w : wait for the kext to be unloaded\n");
fprintf (stderr, " -m : request metadata\n");
+ fprintf (stderr, " -R : reset all counters\n");
exit(1);
}
uuid_t uuid;
int c;
- while ((c = getopt(argc, argv, "hHwm")) != EOF) {
+ while ((c = getopt(argc, argv, "hHwmR")) != EOF) {
switch(c) {
+ case 'R':
+ flags |= PGO_RESET_ALL;
+ break;
case 'H':
flags |= PGO_HIB;
break;
}
}
+ if (flags & PGO_RESET_ALL) {
+ if (flags != PGO_RESET_ALL || uuidp) {
+ usage(argv);
+ }
+ ssize_t r = grab_pgo_data(NULL, PGO_RESET_ALL, NULL, 0);
+ if (r < 0)
+ {
+ perror("grab_pgo_data");
+ return 1;
+ }
+ return 0;
+ }
+
ssize_t size = grab_pgo_data(uuidp, flags, NULL, 0);
if (size < 0)
}
return 0;
-
}