public static void premain( String agentArgs, Instrumentation inst ) throws Exception
   {
      InputStream input = findConfiguration( agentArgs );

      if (input == null)
      {
         throw new IOException( "The specified configuration was not found on the file-system in the current-working-directory, inside any JAR loaded by this class-path, or inside the TheProf JAR." );
      }

      Configuration config = XmlUtility.loadConfiguration( input );

      Logger.log( "adding shutdown hook and agent..." );

      try
      {
         Transformer transformer = new Transformer( config ); 
         
         inst.addTransformer( transformer );
         
         if (config.mode == AgentMode.CSV)
         {
            Runtime.getRuntime().addShutdownHook( new CsvWriter() );
            
            Logger.log( "success adding agent and hook" );
         }
      }
      catch (Exception e)
      {
         Logger.log( "error adding agent: %s", e.getMessage() );
      }
   }