Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[JENKINS-21284] Add some logging to show what the sorter is doing
Now logging number of sorted items on FINE after sorting
  • Loading branch information
emsa23 committed Jan 8, 2014
1 parent 1664a01 commit 444dc15
Showing 1 changed file with 14 additions and 0 deletions.
Expand Up @@ -34,6 +34,8 @@
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

import jenkins.advancedqueue.PriorityConfiguration;
import jenkins.advancedqueue.PrioritySorterConfiguration;
Expand All @@ -46,6 +48,8 @@
@Extension
public class AdvancedQueueSorter extends QueueSorter {

private final static Logger LOGGER = Logger.getLogger("PrioritySorter.Queue.Sorter");

public AdvancedQueueSorter() {
}

Expand All @@ -64,6 +68,7 @@ public int compare(BuildableItem o1, BuildableItem o2) {
// Listener called before we get here so make sure we mark buildable
QueueItemCache.get().getItem(item.id).setBuildable();
}
LOGGER.fine("Initialized the QueueSorter with " + items.size() + " Buildable Items");
}

@Override
Expand All @@ -86,6 +91,15 @@ public int compare(BuildableItem o1, BuildableItem o2) {
return (int) (o1.getInQueueSince() - o2.getInQueueSince());
}
});
//
if (items.size() > 0
&& (LOGGER.getLevel().intValue() >= Level.FINE.intValue() || LOGGER.getLevel().intValue() == Level.ALL
.intValue())) {
float minWeight = QueueItemCache.get().getItem(items.get(0).id).getWeight();
float maxWeight = QueueItemCache.get().getItem(items.get(items.size() - 1).id).getWeight();
LOGGER.log(Level.INFO, "Sorted {0} Buildable Items with Min Weight {1} and Max Weight {2}", new Object[] {
items.size(), minWeight, maxWeight });
}
}

/**
Expand Down

0 comments on commit 444dc15

Please sign in to comment.