comparison rust/hg-core/src/dirstate_tree/dirstate_map.rs @ 47118:c92e63762573

dirstate-tree: Add #[timed] attribute to `status` and `DirstateMap::read` When running with a `RUST_LOG=trace` environment variable, the `micro_timer` crate prints the duration taken by each call to functions with that attribute. Differential Revision: https://phab.mercurial-scm.org/D10552
author Simon Sapin <simon.sapin@octobus.net>
date Tue, 27 Apr 2021 17:49:38 +0200
parents 04bcba539c96
children 15395fd8ab28
comparison
equal deleted inserted replaced
47117:60d852ae7e7b 47118:c92e63762573
1 use bytes_cast::BytesCast; 1 use bytes_cast::BytesCast;
2 use micro_timer::timed;
2 use std::path::PathBuf; 3 use std::path::PathBuf;
3 use std::{collections::BTreeMap, convert::TryInto}; 4 use std::{collections::BTreeMap, convert::TryInto};
4 5
5 use super::path_with_basename::WithBasename; 6 use super::path_with_basename::WithBasename;
6 use crate::dirstate::parsers::clear_ambiguous_mtime; 7 use crate::dirstate::parsers::clear_ambiguous_mtime;
497 fn set_parents(&mut self, parents: &DirstateParents) { 498 fn set_parents(&mut self, parents: &DirstateParents) {
498 self.parents = Some(parents.clone()); 499 self.parents = Some(parents.clone());
499 self.dirty_parents = true; 500 self.dirty_parents = true;
500 } 501 }
501 502
503 #[timed]
502 fn read<'a>( 504 fn read<'a>(
503 &mut self, 505 &mut self,
504 file_contents: &'a [u8], 506 file_contents: &'a [u8],
505 ) -> Result<Option<&'a DirstateParents>, DirstateError> { 507 ) -> Result<Option<&'a DirstateParents>, DirstateError> {
506 if file_contents.is_empty() { 508 if file_contents.is_empty() {