Skip to content

Commit

Permalink
STAT-201: Added some profiling info to Overview Page when debug loggi…
Browse files Browse the repository at this point in the history
…ng is enabled.

git-svn-id: https://source.sakaiproject.org/svn/sitestats/trunk@75724 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
nfgrilo committed Apr 6, 2010
1 parent a5fe21d commit 1660d33
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,11 @@ private WidgetMiniStat getMiniStatActivityEvents() {
private static final long serialVersionUID = 1L;
@Override
public String getValue() {
return Long.toString(Locator.getFacade().getStatsManager().getTotalSiteActivity(siteId, getPrefsdata().getToolEventsStringList()));
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
String val = Long.toString(Locator.getFacade().getStatsManager().getTotalSiteActivity(siteId, getPrefsdata().getToolEventsStringList()));
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatActivityEvents() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}
@Override
public String getSecondValue() {
Expand Down Expand Up @@ -164,12 +168,17 @@ private WidgetMiniStat getMiniStatMostActiveTool() {

@Override
public String getValue() {
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
processData();
String val = null;
if(mostActiveTool != null) {
return Locator.getFacade().getEventRegistryService().getToolName(mostActiveTool);
val = Locator.getFacade().getEventRegistryService().getToolName(mostActiveTool);
}else{
return "-";
val = "-";
}
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatMostActiveTool() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}

@Override
Expand Down Expand Up @@ -278,7 +287,10 @@ private WidgetMiniStat getMiniStatMostActiveUser() {

@Override
public String getValue() {
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
processData();
String val = null;
if(mostActiveUser != null) {
String id = null;
if(("-").equals(mostActiveUser) || ("?").equals(mostActiveUser)){
Expand All @@ -290,10 +302,12 @@ public String getValue() {
id = mostActiveUser;
}
}
return id;
val = id;
}else{
return "-";
val = "-";
}
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatMostActiveUser() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,11 @@ private WidgetMiniStat getMiniStatFiles() {
private static final long serialVersionUID = 1L;
@Override
public String getValue() {
return Integer.toString(getTotalFiles());
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
String val = Integer.toString(getTotalFiles());
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatFiles() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}
@Override
public String getSecondValue() {
Expand Down Expand Up @@ -166,8 +170,13 @@ private WidgetMiniStat getMiniStatOpenedFiles() {

@Override
public String getValue() {
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
processData();
return Long.toString(totalDistinctFileReads);
String val = Long.toString(totalDistinctFileReads);
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatOpenedFiles() in " + (System.currentTimeMillis() - start) + " ms");
return val;

}

@Override
Expand Down Expand Up @@ -268,12 +277,17 @@ private WidgetMiniStat getMiniStatMostOpenedFile() {

@Override
public String getValue() {
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
processData();
String val = null;
if(mostOpenedFile != null) {
return Locator.getFacade().getStatsManager().getResourceName(mostOpenedFile, false);
val = Locator.getFacade().getStatsManager().getResourceName(mostOpenedFile, false);
}else{
return "-";
val = "-";
}
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatMostOpenedFile() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}

@Override
Expand Down Expand Up @@ -363,7 +377,10 @@ private WidgetMiniStat getMiniStatUserThatOpenedMoreFiles() {

@Override
public String getValue() {
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
processData();
String val = null;
if(user != null) {
String id = null;
if(("-").equals(user) || ("?").equals(user)){
Expand All @@ -375,10 +392,12 @@ public String getValue() {
id = user;
}
}
return id;
val = id;
}else{
return "-";
val = "-";
}
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatUserThatOpenedMoreFiles() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ private WidgetMiniStat getMiniStatVisits() {
private static final long serialVersionUID = 1L;
@Override
public String getValue() {
return Long.toString(Locator.getFacade().getStatsManager().getTotalSiteVisits(siteId));
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
String val = Long.toString(Locator.getFacade().getStatsManager().getTotalSiteVisits(siteId));
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatVisits() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}
@Override
public String getSecondValue() {
Expand Down Expand Up @@ -151,7 +155,11 @@ private WidgetMiniStat getMiniStatUniqueVisits() {
private static final long serialVersionUID = 1L;
@Override
public String getValue() {
return Long.toString(Locator.getFacade().getStatsManager().getTotalSiteUniqueVisits(siteId));
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
String val = Long.toString(Locator.getFacade().getStatsManager().getTotalSiteUniqueVisits(siteId));
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatUniqueVisits() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}
@Override
public String getSecondValue() {
Expand Down Expand Up @@ -206,7 +214,11 @@ private WidgetMiniStat getMiniStatEnrolledUsers() {
private static final long serialVersionUID = 1L;
@Override
public String getValue() {
return Long.toString(Locator.getFacade().getStatsManager().getTotalSiteUsers(siteId));
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
String val = Long.toString(Locator.getFacade().getStatsManager().getTotalSiteUsers(siteId));
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatEnrolledUsers() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}
@Override
public String getSecondValue() {
Expand Down Expand Up @@ -238,6 +250,8 @@ private WidgetMiniStat getMiniStatEnrolledUsersWithVisits() {

@Override
public String getValue() {
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
int enrUsersWithVisits = 0;
Set<String> enrUsers = getSiteUsers();
Set<String> usersWithVisits = getUsersWithVisits();
Expand All @@ -246,7 +260,9 @@ public String getValue() {
enrUsersWithVisits++;
}
}
return String.valueOf(enrUsersWithVisits);
String val = String.valueOf(enrUsersWithVisits);
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatEnrolledUsersWithVisits() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}
@Override
public String getSecondValue() {
Expand Down Expand Up @@ -298,6 +314,8 @@ private WidgetMiniStat getMiniStatEnrolledUsersWithoutVisits() {

@Override
public String getValue() {
long start = 0;
if(LOG.isDebugEnabled()) start = System.currentTimeMillis();
int enrUsersWithoutVisits = 0;
Set<String> enrUsers = getSiteUsers();
Set<String> usersWithVisits = getUsersWithVisits();
Expand All @@ -306,7 +324,9 @@ public String getValue() {
enrUsersWithoutVisits++;
}
}
return String.valueOf(enrUsersWithoutVisits);
String val = String.valueOf(enrUsersWithoutVisits);
if(LOG.isDebugEnabled()) LOG.debug("getMiniStatEnrolledUsersWithoutVisits() in " + (System.currentTimeMillis() - start) + " ms");
return val;
}
@Override
public String getSecondValue() {
Expand Down

0 comments on commit 1660d33

Please sign in to comment.