<commit_before>/******************************************************************************
 * Copyright 2018 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

#ifndef CYBER_SCHEDULER_POLICY_CLASSIC_H_
#define CYBER_SCHEDULER_POLICY_CLASSIC_H_

#include <array>
#include <functional>
#include <memory>
#include <vector>

#include "cyber/base/atomic_rw_lock.h"
#include "cyber/scheduler/processor_context.h"

#define MAX_SCHED_PRIORITY 20

namespace apollo {
namespace cyber {
namespace scheduler {

using croutine::CRoutine;
using apollo::cyber::base::AtomicRWLock;
using apollo::cyber::base::ReadLockGuard;
using apollo::cyber::base::WriteLockGuard;

class ClassicContext : public ProcessorContext {
 public:
  bool DispatchTask(const std::shared_ptr<CRoutine>) override;
  bool Enqueue(const std::shared_ptr<CRoutine> cr) override;
  bool RqEmpty() override;
  std::shared_ptr<CRoutine> NextRoutine() override;


 private:
  static std::array<AtomicRWLock, MAX_SCHED_PRIORITY> rw_locks_;
  static std::array<std::vector<std::shared_ptr<CRoutine>>,
      MAX_SCHED_PRIORITY> rq_;
};

}  // namespace scheduler
}  // namespace cyber
}  // namespace apollo

#endif  // CYBER_SCHEDULER_POLICY_CLASSIC_H_<commit_msg>framework: align some variables to cache line in classic sched-policy<commit_after>/******************************************************************************
 * Copyright 2018 The Apollo Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *****************************************************************************/

#ifndef CYBER_SCHEDULER_POLICY_CLASSIC_H_
#define CYBER_SCHEDULER_POLICY_CLASSIC_H_

#include <array>
#include <functional>
#include <memory>
#include <vector>

#include "cyber/base/atomic_rw_lock.h"
#include "cyber/scheduler/processor_context.h"

#define MAX_SCHED_PRIORITY 20

namespace apollo {
namespace cyber {
namespace scheduler {

using croutine::CRoutine;
using apollo::cyber::base::AtomicRWLock;
using apollo::cyber::base::ReadLockGuard;
using apollo::cyber::base::WriteLockGuard;

class ClassicContext : public ProcessorContext {
 public:
  bool DispatchTask(const std::shared_ptr<CRoutine>) override;
  bool Enqueue(const std::shared_ptr<CRoutine> cr) override;
  bool RqEmpty() override;
  std::shared_ptr<CRoutine> NextRoutine() override;


 private:
  alignas(CACHELINE_SIZE) static std::array<AtomicRWLock, MAX_SCHED_PRIORITY>
    rw_locks_;
  alignas(CACHELINE_SIZE) static std::array<std::vector
    <std::shared_ptr<CRoutine>>, MAX_SCHED_PRIORITY> rq_;
};

}  // namespace scheduler
}  // namespace cyber
}  // namespace apollo

#endif  // CYBER_SCHEDULER_POLICY_CLASSIC_H_
{'fraction_non_alphanumeric': 0.16776576101292534, 'fraction_numerical': 0.005275652862041678, 'mean_word_length': 6.022222222222222, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '905679', 'n_tokens_mistral': 1137, 'n_tokens_neox': 1091, 'n_words': 325}