-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log memory usage of the agent and the mapper
The default interval is of 60 seconds. This can be changed using the --log-memory-interval flag which sets the logging interval in seconds. ``` $ target/debug/tedge-mapper --log-memory-interval 5 c8y $ sudo target/debug/tedge-agent --log-memory-interval 5 ``` Signed-off-by: Didier Wenzek <[email protected]>
- Loading branch information
1 parent
5d2b1be
commit e783cfb
Showing
11 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,23 @@ | ||
use cap::Cap; | ||
use clap::Parser; | ||
use std::alloc; | ||
|
||
#[global_allocator] | ||
static ALLOCATOR: Cap<alloc::System> = Cap::new(alloc::System, usize::MAX); | ||
|
||
#[tokio::main] | ||
async fn main() -> Result<(), anyhow::Error> { | ||
async fn main() -> anyhow::Result<()> { | ||
let agent_opt = tedge_agent::AgentOpt::parse(); | ||
let tedge_config = tedge_config::load_tedge_config(&agent_opt.config_dir)?; | ||
let log_memory_interval = tedge_config.run.log_memory_interval.duration(); | ||
if !log_memory_interval.is_zero() { | ||
tokio::spawn(async move { | ||
loop { | ||
log::info!("Allocated memory: {} Bytes", ALLOCATOR.allocated()); | ||
tokio::time::sleep(log_memory_interval).await; | ||
} | ||
}); | ||
} | ||
|
||
tedge_agent::run(agent_opt).await | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,24 @@ | ||
use cap::Cap; | ||
use clap::Parser; | ||
use std::alloc; | ||
use tracing::log; | ||
|
||
#[global_allocator] | ||
static ALLOCATOR: Cap<alloc::System> = Cap::new(alloc::System, usize::MAX); | ||
|
||
#[tokio::main] | ||
async fn main() -> anyhow::Result<()> { | ||
let mapper_opt = tedge_mapper::MapperOpt::parse(); | ||
let tedge_config = tedge_config::load_tedge_config(&mapper_opt.config_dir)?; | ||
let log_memory_interval = tedge_config.run.log_memory_interval.duration(); | ||
if !log_memory_interval.is_zero() { | ||
tokio::spawn(async move { | ||
loop { | ||
log::info!("Allocated memory: {} Bytes", ALLOCATOR.allocated()); | ||
tokio::time::sleep(log_memory_interval).await; | ||
} | ||
}); | ||
} | ||
|
||
tedge_mapper::run(mapper_opt).await | ||
} |