Log the IMU and PWM outputs at the same timestamp

I am logging the IMU gyro data and PWM outputs data for my experiment I need at a speed of 300HZ from pixhawk but in my log it is logging at a speed of 50HZ and by using this


I am logging at 250HZ its good ,but it is not storing both data at same timestamp .The gap between the two values of gyro and pwm outputs and the timestamp values of gyro and pwm outputs are also not getting correspondingly for one value it is getting 5ms and for another two values I am getting 11ms random values are getting

Can anyone help me to get the values of both gyro and pwm outputs at same timestamp and same number of values within the log time