![커널 타임 슬라이스 ID 가져오기](https://linux55.com/image/154273/%EC%BB%A4%EB%84%90%20%ED%83%80%EC%9E%84%20%EC%8A%AC%EB%9D%BC%EC%9D%B4%EC%8A%A4%20ID%20%EA%B0%80%EC%A0%B8%EC%98%A4%EA%B8%B0.png)
배경: 내 커널 드라이버에서 오류를 추적하는 데 사용되는 시간 측정에 차이가 있음을 발견했습니다. 한 번의 시도 중에 드라이버가 중단되어 다음 시간 조각까지 일시 중지되어야 했기 때문에 이것이 가능하다고 확신합니다.
이제 이것을 추적할 수 있는지 궁금합니다.
내 질문은 실제 질문보다 일반적인 아이디어에 가깝습니다.
현재 타임슬라이스 ID나 이와 유사한 것을 얻을 수 있습니까?
다음은 디버깅을 위해 이 코드를 사용하는 방법에 대한 작은 의사코드 예제입니다.
long starttime = get_time(); // Just a function to get the time
long timeslice_id = get_scheduler_timeslice(); // This is what I am looking for
do_lengthy_things();
print("Code took %d ms to run.", get_time() - starttime);
if (get_scheduler_timeslice() != timeslice_id)
print("There was a task switch while running this code, don't wonder about the time.");