readahead-analyze.c revision 8b38f3cc3eb73adf9536cb73d0f319e60d42ea0c
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2012 Auke Kok <auke-jan.h.kok@intel.com>
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>
#include <inttypes.h>
#include <string.h>
#include "readahead-common.h"
int main_analyze(const char *pack_path) {
int a;
int missing = 0;
if (!pack_path)
pack_path = "/.readahead";
if (!pack) {
log_error("Pack file missing.");
goto fail;
}
log_error("Pack file corrupt.");
goto fail;
}
log_error("Pack file version incompatible with this parser.");
goto fail;
}
log_error("Pack file corrupt.");
goto fail;
}
fputs(" pct sections size: path\n"
" === ======== ====: ====\n", stdout);
for (;;) {
int pages = 0;
int sections = 0;
break; /* done */
log_error("Pack file corrupt.");
goto fail;
}
for (;;) {
uint32_t b, c;
log_error("Pack file corrupt.");
goto fail;
}
if ((b == 0) && (c == 0))
break;
/* Uncomment this to get all the chunks separately
printf(" %d: %d %d\n", sections, b, c);
*/
pages += (c - b);
sections++;
}
if (sections == 0)
else
printf(" %4d%% (%2d) %12ld: %s\n",
(unsigned long)size,
path);
} else {
printf(" %4dp (%2d) %12s: %s (MISSING)\n",
"???",
path);
missing++;
}
}
printf("\nHOST: %s"
"TYPE: %c\n"
"MISSING: %d\n"
"TOTAL: %ld\n",
line,
a,
tsize);
return EXIT_SUCCESS;
fail:
return EXIT_FAILURE;
}