在C#

时间:2015-09-12 17:38:09

标签: c# .net windows service

我想知道C#中特定服务的CPU使用率。

PerformanceCounter适用于进程:

PerformanceCounter counter = new PerformanceCounter("Process", "% Processor Time", "myprocess", true);  
double result = counter.NextValue();

但没有服务:

   PerformanceCounter counter = new PerformanceCounter("Service", "% Processor Time", "myservice", true);  
    double result = counter.NextValue();

1 个答案:

答案 0 :(得分:4)

性能计数器的正确名称是

 public function postUpdateDescription(UpdateClinicDescriptionFormRequest $request, $id)
 {
    $clinic = Clinic::find($id);

    $clinic->description = Input::get('description');
    $clinic->save();
    return redirect()->back();

}