private static void Process_time()
{     
      int intInterval = 1000; // 1 second
      string procName = "ProcessName";
      
      while (true)
      {
             Process[] runningNow = Process.GetProcesses();             
             foreach (Process process in runningNow)
             {
                   using (PerformanceCounter pcProcess = new PerformanceCounter("Process", "% Processor Time", process.ProcessName))
                   {   
                        if (process.ProcessName == procName)>
                        {
                              pcProcess.NextValue();
                              System.Threading.Thread.Sleep(1000);
                              Console.WriteLine("Process:{0} CPU% {1}", process.ProcessName, pcProcess.NextValue());
       
                            //if (pcProcess.NextValue() > float.Parse("10");
                            // process의 점유율을 체크하여 10 이상이면 kill
                            //{
                            //    Console.WriteLine(string.Format("Killing {0} at {1}", procName, DateTime.Now.ToString()));
                            //    process.Kill();
                            //}
                        }
                   }
              }
                // Sleep till the next loop
                Thread.Sleep(intInterval);      
      }
}


1. 루팅이 되어 있어야 할......껄??

2. 모토로라용 USB드라이버 설치

3. 설정 > 응용프로그램 > 개발 > USB디버깅 체크

4. 모토로라 휴대전화 도구로 컴퓨터와 폰 연결

5. cmd 띄워서 adb shell > $ su

6. 폰에서 superuser 화면 확인

7. Do

string sql = "Provider=OraOLEDB.Oracle.1;Data Source=orcl;Persist Security Info=True;User ID=아이다;Password=비밀번호;";     //oracle 서버 연결 문자열

            OleDbConnection conn = new OleDbConnection(sql);
            conn.ConnectionString = sql;
            try
            {
                conn.Open();            //데이터베이스 연결
                OleDbCommand cmd = new OleDbCommand();
                cmd.CommandText = "select * from 테이블";   //테이블
                cmd.CommandType = CommandType.Text;         //검색쿼리
                cmd.Connection = conn;

                OleDbDataReader read = cmd.ExecuteReader(); //select 쿼리 결과
                Console.WriteLine("***** 테이블 분석 결과 *****");
                for (int i = 0; i < read.FieldCount; i++)
                {
                    Console.WriteLine("필드이름 : {0} \n", read.GetName(i));
                }
                Console.WriteLine("총필드 개수는" + read.FieldCount);
                read.Close();
            }
            catch (Exception ex)
            {
                Console.WriteLine("에러발생{0}", ex.Message);
            }
            finally
            {
                if (conn != null)
                {
                    conn.Close();       //데이터베이스 연결 해제
                    Console.WriteLine("데이터베이스 연결 해제..");
                }
            }

+ Recent posts