Skip to content

Commit

Permalink
Updated procedure to avoid constant openning cmd window on Windows to…
Browse files Browse the repository at this point in the history
… execute task list.
  • Loading branch information
Anton Datsuk committed Sep 25, 2024
1 parent 69c58d9 commit 1b5e918
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ihp-sg13g2/libs.tech/klayout/tech/lvs/sg13g2_full.lylvs
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,14 @@ exec_start_time = Time.now
logger = Logger.new($stdout)
# Cross-platform memory usage retrieval
require 'win32ole'
def get_memory_usage
if Gem.win_platform?
`tasklist /FI "PID eq #{Process.pid}" /FO LIST`.lines.find { |line| line.include?("Mem Usage") }.strip
wmi = WIN32OLE.connect("winmgmts://")
processes = wmi.ExecQuery("select * from Win32_Process where ProcessId = #{Process.pid}")
process = processes.each.next # Get the first result
"#{process.WorkingSetSize.to_i / 1024} KB"
else
`ps -o rss= -p #{Process.pid}`.strip + " KB"
end
Expand Down

0 comments on commit 1b5e918

Please sign in to comment.