Skip to content

Commit

Permalink
[winperfcounters] abstracting create function
Browse files Browse the repository at this point in the history
  • Loading branch information
haf committed Dec 18, 2016
1 parent a811130 commit 137b7b1
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/metrics/Logary.Metrics.WinPerfCounters/Script.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ module WPC =
wpc.shutdownCh *<-=>- id

// Create

let forProcess (category, counter, units) : CreateResult =
let private create (category, counter, units) scope =
match Category.create category with
| None -> CategoryDoesNotExist
| Some category ->
Expand All @@ -280,20 +279,23 @@ module WPC =
let server =
Impl.loop { category = category
counter = counter
scope = Scope.Process
scope = scope
units = units }
queryCh shutdownCh
let source = MetricSource.create queryCh shutdownCh server
Success source

let forProcess (category, counter, units) : CreateResult =
create (category, counter, units) Scope.Process

let forSet (category, counter, units) queryInstances : CreateResult =
CategoryDoesNotExist
create (category, counter, units) (Scope.Set queryInstances)

let forAll (category, counter, units) : CreateResult =
CategoryDoesNotExist
create (category, counter, units) Scope.All

let totalFor (category, counter, units) : CreateResult =
CategoryDoesNotExist
create (category, counter, units) Scope.Total

// Convert

Expand Down

0 comments on commit 137b7b1

Please sign in to comment.