@@ -243,7 +243,8 @@ static void set_Mithril_params(Mithril_params_t *Mithril_params,
243243 @param req the request containing the request
244244 @return
245245*/
246- static void Mithril_handle_find (cache_t * cache , const request_t * req ) {
246+ static void Mithril_handle_find (cache_t * cache , const request_t * req ,
247+ bool hit ) {
247248 Mithril_params_t * Mithril_params =
248249 (Mithril_params_t * )(cache -> prefetcher -> params );
249250
@@ -267,7 +268,13 @@ static void Mithril_handle_find(cache_t *cache, const request_t *req) {
267268 }
268269 }
269270
270- if (Mithril_params -> rec_trigger != evict ) _Mithril_record_entry (cache , req );
271+ // 1. record entry when rec_trigger is each_req.
272+ // 2. record entry when (rec_trigger is miss or miss_evict (in other words,
273+ // !evict)) && !hit
274+ if ((Mithril_params -> rec_trigger == each_req ) ||
275+ (Mithril_params -> rec_trigger != evict && !hit )) {
276+ _Mithril_record_entry (cache , req );
277+ }
271278}
272279
273280/**
@@ -624,13 +631,6 @@ static inline void _Mithril_record_entry(cache_t *cache, const request_t *req) {
624631
625632 int i ;
626633
627- if (Mithril_params -> rec_trigger != each_req &&
628- cache -> find (cache , req , false)) {
629- /* if it does not record at each request, check whether it is hit or miss
630- */
631- return ;
632- }
633-
634634 /* check it is sequtial or not */
635635 if (Mithril_params -> sequential_type && _Mithril_check_sequential (cache , req ))
636636 return ;
0 commit comments