Class PackStatistics


  • public class PackStatistics
    extends Object
    Statistics about PackWriter pack creation.
    Since:
    4.1
    • Constructor Detail

      • PackStatistics

        public PackStatistics​(PackStatistics.Accumulator accumulator)
        Creates a new PackStatistics object from the accumulator.
        Parameters:
        accumulator - the accumulator of the statistics
    • Method Detail

      • getAdvertised

        public long getAdvertised()
        Get the count of references in the ref advertisement.
        Returns:
        count of refs in the ref advertisement.
        Since:
        4.11
      • getWants

        public long getWants()
        Get the count of client wants.
        Returns:
        count of client wants.
        Since:
        4.11
      • getHaves

        public long getHaves()
        Get the count of client haves.
        Returns:
        count of client haves.
        Since:
        4.11
      • getNotAdvertisedWants

        public long getNotAdvertisedWants()
        Get the count of client wants that were not advertised by the server.
        Returns:
        count of client wants that were not advertised by the server.
        Since:
        5.10
      • getTimeNegotiating

        public long getTimeNegotiating()
        Time in ms spent in the negotiation phase. For non-bidirectional transports (e.g., HTTP), this is only for the final request that sends back the pack file.
        Returns:
        time for ref advertisement in ms.
        Since:
        4.11
      • getInterestingObjects

        public Set<ObjectId> getInterestingObjects()
        Get unmodifiable collection of objects to be included in the pack.
        Returns:
        unmodifiable collection of objects to be included in the pack. May be null if the pack was hand-crafted in a unit test.
      • getUninterestingObjects

        public Set<ObjectId> getUninterestingObjects()
        Get unmodifiable collection of objects that should be excluded from the pack
        Returns:
        unmodifiable collection of objects that should be excluded from the pack, as the peer that will receive the pack already has these objects.
      • getClientShallowCommits

        public Set<ObjectId> getClientShallowCommits()
        Get unmodifiable collection of objects that were shallow commits on the client.
        Returns:
        unmodifiable collection of objects that were shallow commits on the client.
      • getReusedPacks

        public List<CachedPack> getReusedPacks()
        Get unmodifiable list of the cached packs that were reused in the output
        Returns:
        unmodifiable list of the cached packs that were reused in the output, if any were selected for reuse.
      • getRootCommits

        public Set<ObjectId> getRootCommits()
        Get unmodifiable collection of the root commits of the history.
        Returns:
        unmodifiable collection of the root commits of the history.
      • getDeltaSearchNonEdgeObjects

        public int getDeltaSearchNonEdgeObjects()
        Get number of objects in the output pack that went through the delta search process in order to find a potential delta base.
        Returns:
        number of objects in the output pack that went through the delta search process in order to find a potential delta base.
      • getDeltasFound

        public int getDeltasFound()
        Get number of objects in the output pack that went through delta base search and found a suitable base.
        Returns:
        number of objects in the output pack that went through delta base search and found a suitable base. This is a subset of getDeltaSearchNonEdgeObjects().
      • getTotalObjects

        public long getTotalObjects()
        Get total number of objects output.
        Returns:
        total number of objects output. This total includes the value of getTotalDeltas().
      • getBitmapIndexMisses

        public long getBitmapIndexMisses()
        Get the count of objects that needed to be discovered through an object walk because they were not found in bitmap indices.
        Returns:
        the count of objects that needed to be discovered through an object walk because they were not found in bitmap indices. Returns -1 if no bitmap indices were found.
      • getTotalDeltas

        public long getTotalDeltas()
        Get total number of deltas output.
        Returns:
        total number of deltas output. This may be lower than the actual number of deltas if a cached pack was reused.
      • getReusedObjects

        public long getReusedObjects()
        Get number of objects whose existing representation was reused in the output.
        Returns:
        number of objects whose existing representation was reused in the output. This count includes getReusedDeltas().
      • getReusedDeltas

        public long getReusedDeltas()
        Get number of deltas whose existing representation was reused in the output.
        Returns:
        number of deltas whose existing representation was reused in the output, as their base object was also output or was assumed present for a thin pack. This may be lower than the actual number of reused deltas if a cached pack was reused.
      • getTotalBytes

        public long getTotalBytes()
        Get total number of bytes written.
        Returns:
        total number of bytes written. This size includes the pack header, trailer, thin pack, and reused cached pack(s).
      • getThinPackBytes

        public long getThinPackBytes()
        Get size of the thin pack in bytes.
        Returns:
        size of the thin pack in bytes, if a thin pack was generated. A thin pack is created when the client already has objects and some deltas are created against those objects, or if a cached pack is being used and some deltas will reference objects in the cached pack. This size does not include the pack header or trailer.
      • byObjectType

        public PackStatistics.ObjectType byObjectType​(int typeCode)
        Get information about this type of object in the pack.
        Parameters:
        typeCode - object type code, e.g. OBJ_COMMIT or OBJ_TREE.
        Returns:
        information about this type of object in the pack.
      • isShallow

        public boolean isShallow()
        Whether the resulting pack file was a shallow pack.
        Returns:
        true if the resulting pack file was a shallow pack.
      • getDepth

        public int getDepth()
        Get depth (in commits) the pack includes if shallow.
        Returns:
        depth (in commits) the pack includes if shallow.
      • getTimeCounting

        public long getTimeCounting()
        Get time in milliseconds spent enumerating the objects that need to be included in the output.
        Returns:
        time in milliseconds spent enumerating the objects that need to be included in the output. This time includes any restarts that occur when a cached pack is selected for reuse.
      • getTimeSearchingForReuse

        public long getTimeSearchingForReuse()
        Get time in milliseconds spent matching existing representations against objects that will be transmitted.
        Returns:
        time in milliseconds spent matching existing representations against objects that will be transmitted, or that the client can be assumed to already have.
      • getTimeSearchingForSizes

        public long getTimeSearchingForSizes()
        Get time in milliseconds spent finding the sizes of all objects that will enter the delta compression search window.
        Returns:
        time in milliseconds spent finding the sizes of all objects that will enter the delta compression search window. The sizes need to be known to better match similar objects together and improve delta compression ratios.
      • getTimeCompressing

        public long getTimeCompressing()
        Get time in milliseconds spent on delta compression.
        Returns:
        time in milliseconds spent on delta compression. This is observed wall-clock time and does not accurately track CPU time used when multiple threads were used to perform the delta compression.
      • getTimeWriting

        public long getTimeWriting()
        Get time in milliseconds spent writing the pack output, from start of header until end of trailer.
        Returns:
        time in milliseconds spent writing the pack output, from start of header until end of trailer. The transfer speed can be approximated by dividing getTotalBytes() by this value.
      • getReachabilityCheckDuration

        public long getReachabilityCheckDuration()
        Get time in milliseconds spent checking if the client has access to the commits they are requesting.
        Returns:
        time in milliseconds spent checking if the client has access to the commits they are requesting.
        Since:
        5.10
      • getTreesTraversed

        public long getTreesTraversed()
        Returns:
        number of trees traversed in the walk when writing the pack.
        Since:
        5.4
      • getOffloadedPackfiles

        public long getOffloadedPackfiles()
        Returns:
        amount of packfiles offloaded (sent as "packfile-uri")/
        Since:
        5.6
      • getOffloadedPackfilesSize

        public long getOffloadedPackfilesSize()
        Returns:
        total size (in bytes) offloaded to HTTP downloads.
        Since:
        5.6
      • getTimeTotal

        public long getTimeTotal()
        Get total time spent processing this pack.
        Returns:
        total time spent processing this pack.
      • getTransferRate

        public double getTransferRate()
        Get the average output speed in terms of bytes-per-second.
        Returns:
        the average output speed in terms of bytes-per-second. getTotalBytes() / (getTimeWriting() / 1000.0).
      • getMessage

        public String getMessage()
        Get formatted message string for display to clients.
        Returns:
        formatted message string for display to clients.
      • getObjectTypes

        public Map<Integer,​PackStatistics.ObjectType> getObjectTypes()
        Get a map containing ObjectType statistics.
        Returns:
        a map containing ObjectType statistics.