Bug 494847 - Kill MTBF, r=dbaron

This commit is contained in:
Phil Ringnalda 2009-06-13 11:53:38 -07:00
parent a85562bc1e
commit e66b1c98fd
5 changed files with 0 additions and 641 deletions

View File

@ -1,65 +0,0 @@
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
#//------------------------------------------------------------------------
#//
#// Makefile for mtbf
#//
#//------------------------------------------------------------------------
#//------------------------------------------------------------------------
#//
#// Specify the depth of the current directory relative to the
#// root of mozilla
#//
#//------------------------------------------------------------------------
DEPTH = ..\..\..\..\
#//------------------------------------------------------------------------
#//
#// Include the common makefile rules
#//
#//------------------------------------------------------------------------
#//
#// Rule to build mtbf.exe
#//
mtbf.exe: mtbf.cpp
$(CC) mtbf.cpp
install:: mtbf.exe

View File

@ -1,330 +0,0 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/***************************************************************************************
* MODULE NOTES -- MTBF -- Mean Time Between Failures
* @update gess 01/04/99
* @update cyeh 03/15/99
*
* MTBF is a simple WinNT application that runs our viewer.exe remotely.
* After viewer crashes (inevitably) the total elapsed time is recorded, and send
* in an HTML mail message to the appropriate recipient. By default, the message
* is sent to rickg, but you can cause it to be sent to anywhere you like.
*
* Note: To compile this program using the existing project file, simply create a
* subst drive on your system using s:\ as the root. Place this project
* there as s:\mtbf. Of course, if this doesn't work for you, it's easy
* to change since there's only one file in the whole project anyway.
*
* Note: We depend on the availability of the blat.exe somewhere in your path.
* You can get your own copy of BLAT at http://gepasi.dbs.aber.ac.uk/softw/Blat.html.
*
***************************************************************************************/
#include <iostream.h>
#include <fstream.h>
#include <process.h>
#include <stdlib.h>
#include <errno.h>
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <direct.h>
const char* gStatus[]={"abnormally","normally"};
bool gSendMail=false;
const char* gDefDir="s:";
char gMTBFDirectory[500]="";
char gDirectory[10];
const char* gDefProgram="viewer.exe";
char gProgram[500];
char gSubject[]="\"Automated MTBF Report\"";
char gRecipient[500]="rgess@san.rr.com";
char gReportFilename[20]="report.html";
char gReportPath[500]="";
const char* gURLFilename="urls.txt";
char gURLPath[500];
int gLoop = 100;
void ExitWithError(const char* aMsg1,const char* aMsg2){
cout << endl << "Error: " << aMsg1;
if(aMsg2)
cout<< " " << aMsg2;
cout <<"."<< endl;
cout << "Process terminated." << endl;
exit(2000);
}
//-d 10 -f c:/apps/utils/urls.txt -m
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void ComputeEXEDirectory(char* aProgramPath,char* anOutputFilename){
char* thePtr=strrchr(aProgramPath,'\\');
if(thePtr) {
strcpy(anOutputFilename,aProgramPath);
anOutputFilename[thePtr-aProgramPath+1]=0;
}
thePtr=strchr(anOutputFilename,'\\');
while(thePtr) {
*thePtr='/';
thePtr=strchr(anOutputFilename,'\\');
}
}
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void initializeSettings(int argc,char* argv[]){
bool theURLFileIsValid=false;
ComputeEXEDirectory(argv[0],gMTBFDirectory);
sprintf(gReportPath,"%s%s",gMTBFDirectory,gReportFilename);
sprintf(gURLPath,"%s%s",gMTBFDirectory,gURLFilename);
for(int i=0;i<argc;i++){
if(0==strnicmp(argv[i],"-f",2)){
//determine which url file to use...
strcpy(gURLPath, argv[i+1]);
fstream in(gURLPath,ios::in);
char buf[500];
buf[0]=0;
in>>buf;
if(!buf[0]){
ExitWithError("Unable to read the given URL file",gURLPath);
}
else {
theURLFileIsValid=true;
}
}
else if(0==strnicmp(argv[i],"-r",2)){
//determine email recipient...
strcpy(gRecipient,argv[i+1]);
gSendMail=true;
}
else if(0==strnicmp(argv[i],"-l",2)){
gLoop = atoi(argv[i+1]);
if ((gLoop > 200) || (gLoop < 0))
ExitWithError("Loop must be a positive value and less than 200", 0);
}
}
if(!theURLFileIsValid)
ExitWithError("You must provide a valid URL textfile",0);
}
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void PrintResultsAsHTML(ostream& aStream,time_t& aStart,time_t& aEnd,int aResult){
time_t ltime;
time( &ltime );
//begin by dumping the MIME header...
/*
aStream << "MIME-Version: 1.0" << endl;
aStream << "Content-Type: text/html; charset=us-ascii" << endl;
aStream << "Subject: Automated MTBF Report" << endl;
// aStream << "To: rick@gessner.com rickg@netscape.com mozilla-layout@mozilla.org" << endl;
*/
int total=aEnd-aStart;
int mins=(aEnd-aStart)/60;
char buffer[50];
sprintf(buffer,"%i mins %i sec",mins,total%60);
aStream << "Automated MTBF Report"<< endl;
aStream << ctime(&ltime) << endl;
aStream << "Running: "<< gDirectory << gProgram << endl;
aStream << "Elapsed: "<< buffer << endl;
aStream << "Exit: "<< gStatus[0==aResult] << endl;
}
/**
*
* @update gess 01/04/99
* @param
* @return
*/
void PrintResults(ostream& aStream,time_t& aStart,time_t& aEnd,int aResult){
time_t ltime;
time( &ltime );
aStream << "=========================================" << endl;
aStream << "Gecko \"Mean Time Between Failure\" Report" << endl;
aStream << "=========================================" << endl;
aStream << "Date: " << ctime( &ltime);
aStream << "Running: " << gDirectory << gProgram << endl;
aStream << "File: " << gURLPath << endl;
int total=aEnd-aStart;
int mins=(aEnd-aStart)/60;
aStream << "MTBF: ";
if(mins>0){
aStream << mins << " min ";
}
const char* status[]={"abnormally","normally"};
aStream << total%60 << " seconds" << endl;
aStream << "Exit: Program terminated " << status[0==aResult] << endl;
}
/**
*
* @update gess 01/04/99
* @param
* @return
*/
bool getPath(char* aBuffer,const char* aFilename,int index){
bool result=false;
if(aFilename){
int len=strlen(aFilename);
if(len>0){
int hit=0;
int pos=len;
while((hit<index) && (--pos>-1)){
if((aFilename[pos]=='\\') || (aFilename[pos]=='/')){
hit++;
}//if
}//while
if(hit==index){
strncpy(aBuffer,aFilename,pos);
aBuffer[pos]=0;
strcat(aBuffer,"\\cache");
result=true;
}
}//if
}//if
return result;
}
/**
*
* @update gess 01/04/99
* @param
* @return
*/
int main(int argc,char* argv[]) {
int result=0;
//result=system("sendmail -t -messagefile=s:/mtbf/msg.txt ");
if(argc>1) {
/*
char* theDir = getenv("moz_src");
if(!theDir)
theDir=getenv("homedrive");
if(theDir)
strcpy(gDirectory,theDir);
else strcpy(gDirectory,gDefDir);
*/
strcpy(gProgram,gDefProgram);
initializeSettings(argc,argv);
// example for CTime::CTime
time_t startTime; // C run-time time (defined in <time.h>)
time( &startTime ) ; // Get the current time from the
char buffer[500];
sprintf(buffer,"%s%s -f %s -r %d",gDirectory,gProgram,gURLPath,gLoop);
result=system(buffer);
time_t endTime; // C run-time time (defined in <time.h>)
time( &endTime ) ; // Get the current time from system
if(gSendMail) {
{
//Write the message out in html form...
fstream out(gReportPath,ios::out);
PrintResultsAsHTML(out,startTime,endTime,result);
}
sprintf(buffer,"blat %s -s %s -t %s",gReportPath,gSubject,gRecipient);
result=system(buffer);
}
else {
cout << endl << endl;
PrintResults(cout,startTime,endTime,result);
}
int err=errno;
switch(errno){
case E2BIG:
cout << "too big" << endl; break;
case EACCES:
cout << "access" << endl; break;
case EMFILE:
cout << "file" << endl; break;
case ENOENT:
cout << "bad file or directory" << endl; break;
case ENOEXEC:
cout << "exec" << endl; break;
case ENOMEM:
cout << "no mem" << endl; break;
default:
break;
}
}
else {
printf("MTBF (Mean time between failures) version 1.1.\n");
printf("This program requires BLAT.EXE, which you can find on the net.\n");
printf("http://gepasi.dbs.aber.ac.uk/softw/Blat.html \n");
printf("Optional arguments: \n");
printf(" -f filename containing URL list\n");
printf(" -r email recipient\n");
printf(" -l loop # of times (default is 100, max is 200)\n");
}
return 0;
}

View File

@ -1,88 +0,0 @@
# Microsoft Developer Studio Project File - Name="mtbf" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
CFG=mtbf - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "mtbf.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "mtbf.mak" CFG="mtbf - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "mtbf - Win32 Release" (based on "Win32 (x86) Console Application")
!MESSAGE "mtbf - Win32 Debug" (based on "Win32 (x86) Console Application")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "mtbf - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
!ELSEIF "$(CFG)" == "mtbf - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
!ENDIF
# Begin Target
# Name "mtbf - Win32 Release"
# Name "mtbf - Win32 Debug"
# Begin Source File
SOURCE=.\main.cpp
# End Source File
# End Target
# End Project

View File

@ -1,29 +0,0 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "mtbf"=.\mtbf.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -1,129 +0,0 @@
http://www.yahoo.com
http://www.netscape.com
http://www.mozilla.org
http://www.microsoft.com
http://www.excite.com
http://www.mckinley.com
http://www.city.net
http://www.webcrawler.com
http://www.mirabilis.com
http://www.infoseek.com
http://www.pathfinder.com
http://www.warnerbros.com
http://www.cnn.com
http://www.altavista.com
http://www.usatoday.com
http://www.disney.com
http://www.starwave.com
http://www.hotwired.com
http://www.hotbot.com
http://www.lycos.com
http://www.pointcast.com
http://www.cnet.com
http://www.search.com
http://www.news.com
http://www.download.com
http://www.geocities.com
http://www.aol.com
http://members.aol.com
http://www.imdb.com
http://uk.imdb.com
http://www.macromedia.com
http://www.infobeat.com
http://www.fxweb.com
http://www.whowhere.com
http://www.real.com
http://www.sportsline.com
http://www.dejanews.com
http://www.the-park.com
http://www.cmpnet.com
http://www.go2net.com
http://www.metacrawler.com
http://www.playsite.com
http://www.stocksite.com
http://www.sony.com
http://www.music.sony.com
http://www.station.sony.com
http://www.scea.sony.com
http://www.infospace.com
http://www.zdnet.com
http://www.hotfiles.com
http://www.chathouse.com
http://www.looksmart.com
http://www.imaginegames.com
http://www.macaddict.com
http://www.rsac.org
http://www.apple.com
http://www.beseen.com
http://www.dogpile.com
http://www.xoom.com
http://www.tucows.com
http://www.freethemes.com
http://www.winfiles.com
http://www.vservers.com
http://www.mtv.com
http://www.the-xfiles.com
http://www.datek.com
http://www.cyberthrill.com
http://www.surplusdirect.com
http://www.tomshardware.com
http://www.bigyellow.com
http://www.100hot.com
http://www.messagemates.com
http://www.onelist.com
http://www.ea.com
http://www.bullfrog.co.uk
http://www.travelocity.com
http://www.ibm.com
http://www.bigcharts.com
http://www.davesclassics.com
http://www.goto.com
http://www.weather.com
http://www.gamespot.com
http://www.bloomberg.com
http://www.winzip.com
http://www.filez.com
http://www.westwood.com
http://www.internet.com
http://www.cardmaster.com
http://www.creaf.com
http://netaddress.usa.net
http://www.occ.com
http://www.as.org
http://www.amazon.com
http://www.drudgereport.com
http://www.hardradio.com
http://www.intel.com
http://www.mp3.com
http://www.ebay.com
http://www.msn.com
http://www.fifa.com
http://www.attitude.com
http://www.happypuppy.com
http://www.gamesdomain.com
http://www.onsale.com
http://www.tm.com
http://www.xlnc1.com
http://www.greatsports.com
http://www.discovery.com
http://www.nai.com
http://www.nasa.gov
http://www.ogr.com
http://www.warzone.com
http://www.gamestats.com
http://www.winamp.com
http://java.sun.com
http://www.hp.com
http://www.cdnow.com
http://www.nytimes.com
http://www.majorleaguebaseball.com
http://www.washingtonpost.com
http://www.planetquake.com
http://www.wsj.com
http://www.slashdot.org
http://www.adobe.com
http://www.quicken.com
http://www.talkcity.com
http://www.developer.com
http://www.mapquest.com
http://www.bluemountain.com