Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
3dd83012
Commit
3dd83012
authored
6 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Move setup of monitoring to InitializePerformanceMonitors
parent
3bdcde90
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ATxService/AutoTx.cs
+47
-38
47 additions, 38 deletions
ATxService/AutoTx.cs
with
47 additions
and
38 deletions
ATxService/AutoTx.cs
+
47
−
38
View file @
3dd83012
...
...
@@ -43,9 +43,12 @@ namespace ATxService
/// <summary>
/// The CPU load monitoring object.
/// </summary>
private
readonly
Cpu
_cpu
;
private
Cpu
_cpu
;
private
readonly
PhysicalDisk
_phyDisk
;
/// <summary>
/// The Disk I/O monitoring object.
/// </summary>
private
PhysicalDisk
_phyDisk
;
private
RoboCommand
_roboCommand
;
...
...
@@ -114,42 +117,9 @@ namespace ATxService
LoadSettings
();
CreateIncomingDirectories
();
try
{
_cpu
=
new
Cpu
{
Interval
=
250
,
Limit
=
_config
.
MaxCpuUsage
,
Probation
=
16
,
Enabled
=
true
};
_cpu
.
LoadAboveLimit
+=
OnLoadAboveLimit
;
_cpu
.
LoadBelowLimit
+=
OnLoadBelowLimit
;
}
catch
(
UnauthorizedAccessException
ex
)
{
Log
.
Error
(
"Not enough permissions to monitor the CPU load.\nMake sure the "
+
"service account is a member of the [Performance Monitor Users] "
+
"system group.\nError message was: {0}"
,
ex
.
Message
);
throw
;
}
catch
(
Exception
ex
)
{
Log
.
Error
(
"Unexpected error initializing CPU monitoring: {0}"
,
ex
.
Message
);
throw
;
}
try
{
_phyDisk
=
new
PhysicalDisk
{
Interval
=
250
,
Limit
=
(
float
)
_config
.
MaxDiskQueue
/
1000
,
Probation
=
16
,
Enabled
=
true
};
_phyDisk
.
LoadAboveLimit
+=
OnLoadAboveLimit
;
_phyDisk
.
LoadBelowLimit
+=
OnLoadBelowLimit
;
}
catch
(
Exception
ex
)
{
Log
.
Error
(
"Unexpected error initializing PhysicalDisk monitoring: {0}"
,
ex
.
Message
);
throw
;
}
InitializePerformanceMonitors
();
StartupSummary
();
if
(
_config
.
DebugRoboSharp
)
{
Debugger
.
Instance
.
DebugMessageEvent
+=
HandleDebugMessage
;
...
...
@@ -361,8 +331,47 @@ namespace ATxService
"indicate the computer has crashed or was forcefully shut off."
,
ServiceName
);
}
_status
.
CleanShutdown
=
false
;
}
StartupSummary
();
/// <summary>
/// Set up the performance monitor objects (CPU, Disk I/O, ...).
/// </summary>
private
void
InitializePerformanceMonitors
()
{
try
{
_cpu
=
new
Cpu
{
Interval
=
250
,
Limit
=
_config
.
MaxCpuUsage
,
Probation
=
16
,
Enabled
=
true
};
_cpu
.
LoadAboveLimit
+=
OnLoadAboveLimit
;
_cpu
.
LoadBelowLimit
+=
OnLoadBelowLimit
;
}
catch
(
UnauthorizedAccessException
ex
)
{
Log
.
Error
(
"Not enough permissions to monitor the CPU load.\nMake sure the "
+
"service account is a member of the [Performance Monitor Users] "
+
"system group.\nError message was: {0}"
,
ex
.
Message
);
throw
;
}
catch
(
Exception
ex
)
{
Log
.
Error
(
"Unexpected error initializing CPU monitoring: {0}"
,
ex
.
Message
);
throw
;
}
try
{
_phyDisk
=
new
PhysicalDisk
{
Interval
=
250
,
Limit
=
(
float
)
_config
.
MaxDiskQueue
/
1000
,
Probation
=
16
,
Enabled
=
true
};
_phyDisk
.
LoadAboveLimit
+=
OnLoadAboveLimit
;
_phyDisk
.
LoadBelowLimit
+=
OnLoadBelowLimit
;
}
catch
(
Exception
ex
)
{
Log
.
Error
(
"Unexpected error initializing PhysicalDisk monitoring: {0}"
,
ex
.
Message
);
throw
;
}
}
/// <summary>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment