@ -714,6 +714,7 @@ public class PackWriter {
if ( ! cachedPacks . isEmpty ( ) )
if ( ! cachedPacks . isEmpty ( ) )
throw new IOException ( JGitText . get ( ) . cachedPacksPreventsIndexCreation ) ;
throw new IOException ( JGitText . get ( ) . cachedPacksPreventsIndexCreation ) ;
long writeStart = System . currentTimeMillis ( ) ;
final List < ObjectToPack > list = sortByName ( ) ;
final List < ObjectToPack > list = sortByName ( ) ;
final PackIndexWriter iw ;
final PackIndexWriter iw ;
int indexVersion = config . getIndexVersion ( ) ;
int indexVersion = config . getIndexVersion ( ) ;
@ -722,6 +723,7 @@ public class PackWriter {
else
else
iw = PackIndexWriter . createVersion ( indexStream , indexVersion ) ;
iw = PackIndexWriter . createVersion ( indexStream , indexVersion ) ;
iw . write ( list , packcsum ) ;
iw . write ( list , packcsum ) ;
stats . timeWriting + = System . currentTimeMillis ( ) - writeStart ;
}
}
private List < ObjectToPack > sortByName ( ) {
private List < ObjectToPack > sortByName ( ) {
@ -828,6 +830,7 @@ public class PackWriter {
stats . timeWriting = System . currentTimeMillis ( ) - writeStart ;
stats . timeWriting = System . currentTimeMillis ( ) - writeStart ;
stats . totalBytes = out . length ( ) ;
stats . totalBytes = out . length ( ) ;
stats . reusedPacks = Collections . unmodifiableList ( cachedPacks ) ;
stats . reusedPacks = Collections . unmodifiableList ( cachedPacks ) ;
stats . depth = depth ;
for ( Statistics . ObjectType typeStat : stats . objectTypes ) {
for ( Statistics . ObjectType typeStat : stats . objectTypes ) {
if ( typeStat = = null )
if ( typeStat = = null )
@ -1870,6 +1873,8 @@ public class PackWriter {
Collection < CachedPack > reusedPacks ;
Collection < CachedPack > reusedPacks ;
int depth ;
int deltaSearchNonEdgeObjects ;
int deltaSearchNonEdgeObjects ;
int deltasFound ;
int deltasFound ;
@ -2012,6 +2017,16 @@ public class PackWriter {
return objectTypes [ typeCode ] ;
return objectTypes [ typeCode ] ;
}
}
/** @return true if the resulting pack file was a shallow pack. */
public boolean isShallow ( ) {
return depth > 0 ;
}
/** @return depth (in commits) the pack includes if shallow. */
public int getDepth ( ) {
return depth ;
}
/ * *
/ * *
* @return time in milliseconds spent enumerating the objects that need
* @return time in milliseconds spent enumerating the objects that need
* to be included in the output . This time includes any restarts
* to be included in the output . This time includes any restarts
@ -2060,6 +2075,15 @@ public class PackWriter {
return timeWriting ;
return timeWriting ;
}
}
/** @return total time spent processing this pack. */
public long getTimeTotal ( ) {
return timeCounting
+ timeSearchingForReuse
+ timeSearchingForSizes
+ timeCompressing
+ timeWriting ;
}
/ * *
/ * *
* @return get the average output speed in terms of bytes - per - second .
* @return get the average output speed in terms of bytes - per - second .
* { @code getTotalBytes ( ) / ( getTimeWriting ( ) / 1000 . 0 ) } .
* { @code getTotalBytes ( ) / ( getTimeWriting ( ) / 1000 . 0 ) } .