Skip to content

Commit 107ebee

Browse files
authored
Merge pull request #8068 from The-OpenROAD-Project-staging/mem-stats
Mem stats
2 parents 4b28c72 + 80db7f0 commit 107ebee

File tree

11 files changed

+34
-8
lines changed

11 files changed

+34
-8
lines changed

src/drt/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ cc_library(
9595
"src/db/drObj/drVia.cpp",
9696
"src/db/infra/KDTree.cpp",
9797
"src/db/infra/frTime.cpp",
98-
"src/db/infra/frTime_helper.cpp",
9998
"src/db/obj/frAccess.cpp",
10099
"src/db/obj/frInst.cpp",
101100
"src/db/obj/frInstTerm.cpp",

src/drt/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ add_library(drt_lib
6363
src/db/drObj/drPin.cpp
6464
src/db/drObj/drShape.cpp
6565
src/db/drObj/drVia.cpp
66-
src/db/infra/frTime_helper.cpp
6766
src/db/infra/frTime.cpp
6867
src/db/infra/KDTree.cpp
6968
src/db/taObj/taShape.cpp

src/drt/src/db/infra/frTime.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include <boost/io/ios_state.hpp>
77
#include <iomanip>
88

9+
#include "utl/mem_stats.h"
10+
911
namespace drt {
1012

1113
void frTime::print(Logger* logger)
@@ -30,8 +32,8 @@ void frTime::print(Logger* logger)
3032
hour,
3133
min,
3234
sec,
33-
getCurrentRSS() / (1024.0 * 1024.0),
34-
getPeakRSS() / (1024.0 * 1024.0));
35+
utl::getCurrentRSS() / (1024.0 * 1024.0),
36+
utl::getPeakRSS() / (1024.0 * 1024.0));
3537
}
3638

3739
std::ostream& operator<<(std::ostream& os, const frTime& t)
@@ -50,7 +52,7 @@ std::ostream& operator<<(std::ostream& os, const frTime& t)
5052
os << ":";
5153
os << std::setw(2) << std::setfill('0') << sec;
5254
os << ", memory = " << std::fixed << std::setprecision(2)
53-
<< getCurrentRSS() * 1.0 / 1024 / 1024 << " (MB)";
55+
<< utl::getCurrentRSS() * 1.0 / 1024 / 1024 << " (MB)";
5456
guard.restore();
5557
return os;
5658
}

src/drt/src/db/infra/frTime.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99

1010
#include "frBaseTypes.h"
1111

12-
extern size_t getPeakRSS();
13-
extern size_t getCurrentRSS();
14-
1512
namespace drt {
1613
class frTime
1714
{

src/rsz/src/RepairDesign.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "sta/Search.hh"
3232
#include "sta/SearchPred.hh"
3333
#include "sta/Units.hh"
34+
#include "utl/mem_stats.h"
3435
#include "utl/scope.h"
3536

3637
namespace rsz {
@@ -2652,6 +2653,8 @@ void RepairDesign::printProgress(int iteration,
26522653
inserted_buffer_count_,
26532654
repaired_net_count,
26542655
nets_left);
2656+
2657+
debugPrint(logger_, RSZ, "memory", 1, "RSS = {}", utl::getCurrentRSS());
26552658
}
26562659

26572660
if (end) {

src/rsz/src/RepairHold.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "sta/TimingArc.hh"
2626
#include "sta/Units.hh"
2727
#include "utl/Logger.h"
28+
#include "utl/mem_stats.h"
2829

2930
namespace rsz {
3031

@@ -889,6 +890,8 @@ void RepairHold::printProgress(int iteration, bool force, bool end) const
889890
delayAsString(wns, sta_, 3),
890891
delayAsString(tns, sta_, 3),
891892
worst_vertex->name(network_));
893+
894+
debugPrint(logger_, RSZ, "memory", 1, "RSS = {}", utl::getCurrentRSS());
892895
}
893896

894897
if (end) {

src/rsz/src/RepairSetup.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "sta/Units.hh"
3939
#include "sta/VerilogWriter.hh"
4040
#include "utl/Logger.h"
41+
#include "utl/mem_stats.h"
4142

4243
namespace rsz {
4344

@@ -764,6 +765,8 @@ void RepairSetup::printProgress(const int iteration,
764765
delayAsString(tns, sta_, 1),
765766
max(0, num_viols),
766767
worst_vertex != nullptr ? worst_vertex->name(network_) : "");
768+
769+
debugPrint(logger_, RSZ, "memory", 1, "RSS = {}", utl::getCurrentRSS());
767770
}
768771

769772
if (end) {

src/utl/BUILD

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ cc_library(
3030
"src/histogram.cpp",
3131
"src/prometheus/metrics_server.cpp",
3232
"src/timer.cpp",
33+
"src/mem_stats.cpp",
3334
],
3435
hdrs = [
3536
"include/utl/CallBack.h",
@@ -66,6 +67,7 @@ cc_library(
6667
"include/utl/scope.h",
6768
"include/utl/timer.h",
6869
"include/utl/validation.h",
70+
"include/utl/mem_stats.h",
6971
],
7072
includes = ["include"],
7173
deps = [

src/utl/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ add_library(utl_lib
4545
src/Progress.cpp
4646
src/CommandLineProgress.cpp
4747
src/timer.cpp
48+
src/mem_stats.cpp
4849
src/decode.cpp
4950
src/prometheus/metrics_server.cpp
5051
src/histogram.cpp

src/utl/include/utl/mem_stats.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// SPDX-License-Identifier: BSD-3-Clause
2+
// Copyright (c) 2019-2025, The OpenROAD Authors
3+
4+
#pragma once
5+
6+
#include <cstddef>
7+
8+
namespace utl {
9+
10+
size_t getPeakRSS();
11+
size_t getCurrentRSS();
12+
13+
} // namespace utl

0 commit comments

Comments
 (0)