60d9fc3b036a7d7ab62c6adb01953f743ddceb6a
   1#include "cache.h"
   2#include "mru.h"
   3
   4char *odb_pack_name(struct strbuf *buf,
   5                    const unsigned char *sha1,
   6                    const char *ext)
   7{
   8        strbuf_reset(buf);
   9        strbuf_addf(buf, "%s/pack/pack-%s.%s", get_object_directory(),
  10                    sha1_to_hex(sha1), ext);
  11        return buf->buf;
  12}
  13
  14char *sha1_pack_name(const unsigned char *sha1)
  15{
  16        static struct strbuf buf = STRBUF_INIT;
  17        return odb_pack_name(&buf, sha1, "pack");
  18}
  19
  20char *sha1_pack_index_name(const unsigned char *sha1)
  21{
  22        static struct strbuf buf = STRBUF_INIT;
  23        return odb_pack_name(&buf, sha1, "idx");
  24}
  25
  26unsigned int pack_used_ctr;
  27unsigned int pack_mmap_calls;
  28unsigned int peak_pack_open_windows;
  29unsigned int pack_open_windows;
  30unsigned int pack_open_fds;
  31unsigned int pack_max_fds;
  32size_t peak_pack_mapped;
  33size_t pack_mapped;
  34struct packed_git *packed_git;
  35
  36static struct mru packed_git_mru_storage;
  37struct mru *packed_git_mru = &packed_git_mru_storage;
  38
  39#define SZ_FMT PRIuMAX
  40static inline uintmax_t sz_fmt(size_t s) { return s; }
  41
  42void pack_report(void)
  43{
  44        fprintf(stderr,
  45                "pack_report: getpagesize()            = %10" SZ_FMT "\n"
  46                "pack_report: core.packedGitWindowSize = %10" SZ_FMT "\n"
  47                "pack_report: core.packedGitLimit      = %10" SZ_FMT "\n",
  48                sz_fmt(getpagesize()),
  49                sz_fmt(packed_git_window_size),
  50                sz_fmt(packed_git_limit));
  51        fprintf(stderr,
  52                "pack_report: pack_used_ctr            = %10u\n"
  53                "pack_report: pack_mmap_calls          = %10u\n"
  54                "pack_report: pack_open_windows        = %10u / %10u\n"
  55                "pack_report: pack_mapped              = "
  56                        "%10" SZ_FMT " / %10" SZ_FMT "\n",
  57                pack_used_ctr,
  58                pack_mmap_calls,
  59                pack_open_windows, peak_pack_open_windows,
  60                sz_fmt(pack_mapped), sz_fmt(peak_pack_mapped));
  61}