惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

B
Blog
C
Check Point Blog
The GitHub Blog
The GitHub Blog
Y
Y Combinator Blog
SecWiki News
SecWiki News
有赞技术团队
有赞技术团队
Latest news
Latest news
D
DataBreaches.Net
Blog — PlanetScale
Blog — PlanetScale
Project Zero
Project Zero
H
Help Net Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
G
GRAHAM CLULEY
Engineering at Meta
Engineering at Meta
T
Threat Research - Cisco Blogs
腾讯CDC
P
Proofpoint News Feed
L
LINUX DO - 热门话题
C
Cisco Blogs
P
Palo Alto Networks Blog
Vercel News
Vercel News
P
Privacy International News Feed
爱范儿
爱范儿
Scott Helme
Scott Helme
L
Lohrmann on Cybersecurity
MyScale Blog
MyScale Blog
K
Kaspersky official blog
B
Blog RSS Feed
美团技术团队
Microsoft Security Blog
Microsoft Security Blog
O
OpenAI News
博客园 - 叶小钗
量子位
T
Tenable Blog
C
Cybersecurity and Infrastructure Security Agency CISA
J
Java Code Geeks
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Hacker News: Ask HN
Hacker News: Ask HN
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LINUX DO - 最新话题
F
Fortinet All Blogs
N
News | PayPal Newsroom
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
博客园 - 【当耐特】
N
News and Events Feed by Topic
V
Visual Studio Blog
Google DeepMind News
Google DeepMind News
Last Week in AI
Last Week in AI

博客园 - N/A2011

Managing Hierarchical Data in MySQL php soapclient with wsse 转贴 MySQL Multiple Result Procs in PHP 转贴 jQuery Datepicker by Example 转贴 Using MySQL Stored Procedures with PHP mysql/mysqli/pdo php generate pdf open office (java) ant + emma + junit Copy all files recursively from one folder to another RecursiveFileFinder 转贴: 怎样找第一份工作 Trace in .net Logger in .net 转贴: 傅立叶级数(Fourier Series) 推导 CAS in .net Encrypting and Decrypting in .net Access Control List in .net User and Data Security in .net Unmanaged code in .net
PerformanceCounter in .net
N/A2011 · 2009-06-22 · via 博客园 - N/A2011

VB.NET:

Imports System.Diagnostics
Imports System.TimersModule Module1
    
Private HeapCounter As PerformanceCounter = Nothing
    
Private ExceptionCounter As PerformanceCounter = Nothing
    
Private timer As Timer = New Timer(3000)Private Sub OnTick(ByVal source As ObjectByVal e As ElapsedEventArgs)End SubSub Main()
        
AddHandler timer.Elapsed, AddressOf OnTick
        timer.Enabled 
= True
        
Dim HeapCounter As New PerformanceCounter(".NET CLR Memory""# Bytes in all Heaps")
        HeapCounter.InstanceName 
= "_Global_"
        
Dim ExceptionCounter As New PerformanceCounter(".Net CLR Exceptions""# of Exceps Thrown")
        ExceptionCounter.InstanceName 
= "_Global_"
        Console.WriteLine(
"Press [Enter] to Quit Program")
        Console.WriteLine(
"# of Bytes in all Heaps : " + HeapCounter.NextValue().ToString())
        Console.WriteLine(
"# of Exceptions Thrown: " + ExceptionCounter.NextValue().ToString())
        Console.ReadLine()
    
End SubEnd Module

C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.Timers;namespace PerformanceCounterCS
{
    
class Program
    {
        
private static PerformanceCounter HeapCounter = null;
        
private static PerformanceCounter ExceptionCounter = null;
        
private static Timer timer = new Timer(3000);private static void OnTick(object source, ElapsedEventArgs e)
        {
        }
static void Main(string[] args)
        {
            timer.Elapsed 
+= new ElapsedEventHandler(OnTick);
            timer.Enabled 
= true;
            HeapCounter 
= new PerformanceCounter(".NET CLR Memory""# Bytes in all Heaps");
            HeapCounter.InstanceName 
= "_Global_";
            ExceptionCounter 
= new PerformanceCounter(".Net CLR Exceptions""# of Exceps Thrown");
            ExceptionCounter.InstanceName 
= "_Global_";
            Console.WriteLine(
"Press [Enter] to Quit Program");
            Console.WriteLine(
"# of Bytes in all Heaps : " + HeapCounter.NextValue().ToString());
            Console.WriteLine(
"# of Exceptions Thrown: " + ExceptionCounter.NextValue().ToString());
            Console.ReadLine();
        }
    }
}