Skip to content

Commit

Permalink
Merge pull request #182 from adatsuk/dev
Browse files Browse the repository at this point in the history
Added cross-platform compatibility for logger
  • Loading branch information
sergeiandreyev authored Aug 13, 2024
2 parents 4519be0 + 42600b0 commit 213d2d0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions ihp-sg13g2/libs.tech/klayout/tech/lvs/sg13g2_full.lylvs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,17 @@ exec_start_time = Time.now
logger = Logger.new($stdout)
# Cross-platform memory usage retrieval
def get_memory_usage
if Gem.win_platform?
`tasklist /FI "PID eq #{Process.pid}" /FO LIST`.lines.find { |line| line.include?("Mem Usage") }.strip
else
`ps -o rss= -p #{Process.pid}`.strip + " KB"
end
end
logger.formatter = proc do |_severity, datetime, _progname, msg|
"#{datetime}: Memory Usage (" + `pmap #{Process.pid} | tail -1`[10, 40].strip + ") : #{msg}
"
"#{datetime}: Memory Usage (" + get_memory_usage + ") : #{msg}\n"
end
#================================================
Expand Down

0 comments on commit 213d2d0

Please sign in to comment.