Detects long-running SQL Server Agent jobs by comparing current execution duration against thresholds derived from historical averages or default limits. Sends email notifications for detected jobs if specified.