Skip to content

Conversation

@aditijannu
Copy link
Contributor

No description provided.

#[cfg(feature = "reduce_randomness")]
{
align = PAGE_SIZE;
size = match memsize {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor: Can we have the size conditionally defined in the match case before this? Since both the size and the layout is being conditionally defined, I was thinking if we can have the size in the condition block this

/* Create a random size depending on the memory type */
        let (scan_interval, mut size, limit) = match memsize {
            MemSize::Large => {
                (
                    SCAN_INTERVAL_LARGE_THREAD,
                    #[cfg(feature = "reduce_randomness")] {crate::TO_GB * 1} 
                    #[cfg(not(feature = "reduce_randomness"))] {TO_GB * get_random_num(LARGE_THREAD_MEM_START, LARGE_THREAD_MEM_END)},
                    LIMIT_LARGE_THREAD,
                )
            }
            MemSize::Medium => {
                (
                    SCAN_INTERVAL_MEDIUM_THREAD,
                    // similarly for medium and small threads
                    TO_MB * get_random_num(MEDIUM_THREAD_MEM_START, MEDIUM_THREAD_MEM_END),
                    LIMIT_MEDIUM_THREAD,
                )
            }
            MemSize::Small => {
                (
                    SCAN_INTERVAL_SMALL_THREAD,
                    TO_KB * get_random_num(SMALL_THREAD_MEM_START, SMALL_THREAD_MEM_END),
                    LIMIT_SMALL_THREAD,
                )
            }
        };

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants