Some fundamental but important questions about web development?

Update, Spring 2018: I wrote this response in 2010 and since then, a whole lot of things have changed in the world of a web backend developer. Namely, the advent of the “cloud” turning services such as one-click load balancers and autoscaling into commodities have made the actual mechanics of scaling your application much easier … Read more

Get Memory Usage in Android

I use this function to calculate cpu usage. Hope it can help you. private float readUsage() { try { RandomAccessFile reader = new RandomAccessFile(“/proc/stat”, “r”); String load = reader.readLine(); String[] toks = load.split(” +”); // Split on one or more spaces long idle1 = Long.parseLong(toks[4]); long cpu1 = Long.parseLong(toks[2]) + Long.parseLong(toks[3]) + Long.parseLong(toks[5]) + Long.parseLong(toks[6]) … Read more

What is the correct Performance Counter to get CPU and Memory Usage of a Process?

From this post: To get the entire PC CPU and Memory usage: using System.Diagnostics; Then declare globally: private PerformanceCounter theCPUCounter = new PerformanceCounter(“Processor”, “% Processor Time”, “_Total”); Then to get the CPU time, simply call the NextValue() method: this.theCPUCounter.NextValue(); This will get you the CPU usage As for memory usage, same thing applies I believe: … Read more

Accurate calculation of CPU usage given in percentage in Linux?

According the htop source code, my assumptions looks like they are valid: (see static inline double LinuxProcessList_scanCPUTime(LinuxProcessList* this) function at LinuxProcessList.c) // Guest time is already accounted in usertime usertime = usertime – guest; # As you see here, it subtracts guest from user time nicetime = nicetime – guestnice; # and guest_nice from nice … Read more

How do I find out what is hammering my SQL Server?

This query uses DMV’s to identify the most costly queries by CPU SELECT TOP 20 qs.sql_handle, qs.execution_count, qs.total_worker_time AS Total_CPU, total_CPU_inSeconds = –Converted from microseconds qs.total_worker_time/1000000, average_CPU_inSeconds = –Converted from microseconds (qs.total_worker_time/1000000) / qs.execution_count, qs.total_elapsed_time, total_elapsed_time_inSeconds = –Converted from microseconds qs.total_elapsed_time/1000000, st.text, qp.query_plan FROM sys.dm_exec_query_stats AS qs CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) AS st CROSS APPLY sys.dm_exec_query_plan … Read more

tech